Is not barrier suitable for that?

Regards,
Ovanes

On Tue, May 5, 2009 at 12:42 PM, Anthony Williams <anthony.ajw@gmail.com> wrote:
Zachary Turner <divisortheory@gmail.com> writes:

> I've been trying to figure out if there's a simple way using condition
> variables and mutexes to design a function with the following properties
> (cliffs notes first, and then longer version in case it's not enough info):
>
> 1) there is a section of code in the function such that two threads cannot
> enter that section at the same time.
> 2) after leaving the section of code, the thread should wait for something to
> happen (signalled by another thread)
> 3) the waits in step 2 should be awoken in the order they occured.

There's nothing in boost to do this. I remember a thread on
comp.programming.threads about a FIFO mutex (which is what you seem to
want). Someone provided an implementation (which may well do what you
want), but the consensus seemed to be "don't do that". If your program
behaviour depends on threads being woken in a specific order then it may
be better to rewrite the code so it doesn't.

Anthony
--
Author of C++ Concurrency in Action | http://www.manning.com/williams
just::thread C++0x thread library   | http://www.stdthread.co.uk
Just Software Solutions Ltd         | http://www.justsoftwaresolutions.co.uk
15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976

_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users