
8 Feb
2008
8 Feb
'08
1:29 p.m.
On Friday 08 February 2008 02:59, Colin Caughie wrote:
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.
Why would you do that? Boost.thread does provide boost::condition, which isn't exactly a semaphore but conditions are designed for just the purpose you describe. -- Frank