Is not barrier suitable for that?<br><br>Regards,<br>Ovanes<br><br><div class="gmail_quote">On Tue, May 5, 2009 at 12:42 PM, Anthony Williams <span dir="ltr">&lt;<a href="mailto:anthony.ajw@gmail.com">anthony.ajw@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">Zachary Turner &lt;<a href="mailto:divisortheory@gmail.com">divisortheory@gmail.com</a>&gt; writes:<br>

<br>
&gt; I&#39;ve been trying to figure out if there&#39;s a simple way using condition<br>
&gt; variables and mutexes to design a function with the following properties<br>
&gt; (cliffs notes first, and then longer version in case it&#39;s not enough info):<br>
&gt;<br>
&gt; 1) there is a section of code in the function such that two threads cannot<br>
&gt; enter that section at the same time.<br>
&gt; 2) after leaving the section of code, the thread should wait for something to<br>
&gt; happen (signalled by another thread)<br>
&gt; 3) the waits in step 2 should be awoken in the order they occured.<br>
<br>
</div>There&#39;s nothing in boost to do this. I remember a thread on<br>
comp.programming.threads about a FIFO mutex (which is what you seem to<br>
want). Someone provided an implementation (which may well do what you<br>
want), but the consensus seemed to be &quot;don&#39;t do that&quot;. If your program<br>
behaviour depends on threads being woken in a specific order then it may<br>
be better to rewrite the code so it doesn&#39;t.<br>
<br>
Anthony<br>
--<br>
Author of C++ Concurrency in Action | <a href="http://www.manning.com/williams" target="_blank">http://www.manning.com/williams</a><br>
just::thread C++0x thread library � | <a href="http://www.stdthread.co.uk" target="_blank">http://www.stdthread.co.uk</a><br>
Just Software Solutions Ltd � � � � | <a href="http://www.justsoftwaresolutions.co.uk" target="_blank">http://www.justsoftwaresolutions.co.uk</a><br>
15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976<br>
<br>
_______________________________________________<br>
Boost-users mailing list<br>
<a href="mailto:Boost-users@lists.boost.org">Boost-users@lists.boost.org</a><br>
<a href="http://lists.boost.org/mailman/listinfo.cgi/boost-users" target="_blank">http://lists.boost.org/mailman/listinfo.cgi/boost-users</a><br>
</blockquote></div><br>