Boost logo

Boost :

From: Colin Caughie (c.caughie_at_[hidden])
Date: 2008-02-08 02:59:50

Clark Sims <clark_sims_boost <at>> writes:

> I defined this class for managing a thread group, with different priorities
for different threads
> I wrote this test example: it
> works perfectly in linux, generating this output :
> on windows, it calls the
appropriate locks, but
> it does not stop when two locks, lock the same mutex:
> My class for managing threads, based upon priorities, won't work unless the
previous small code fragment deadlocks.

Those URLs don't work for me, but presumably what you want is something that
blocks until something is queued to be run by one of the threads in the group.
My suggestion would be to use semaphores rather than mutexes for this. You
initialize the semaphore count to 0 so that the first time you wait for it you
immediately block. When another thread signals the semaphore you wake up.

You'll have to write your own cross-platform semaphore class though as
Boost.Thread doesn't have one.


Boost list run by bdawes at, gregod at, cpdaniel at, john at