Excellent and thanks!   I completely missed boost:condition.

Graham

On 6/18/07, Tobias Schwinger <tschwinger@isonews2.com > wrote:
Zeljko Vrba wrote:
> On Mon, Jun 18, 2007 at 10:48:14AM -0500, Graham Reitz wrote:
>> Is there a method  to release all threads waiting on a mutex?  Or, more
>> generally, a portable way to release a bunch of threads at the same time?
>> (boost::asio?)
>>
>> I didn't see anything in the docs, besides barrier.  Unfortunately, I can't
>> guarantee the N threads will be waiting when a flush is needed.
>>
>
> You want a SYSV-style semaphore (semget/semop/semctl in POSIX; seems not to
> be provided by Boost.Thread).

Not necessarily. It depends on whether we want a thread that reaches the
synchronization point after the "go" to pass (as when downing a
semaphore) or to stop (as with a missed condition notification).

Judging from the OP, the Semaphore-approach seems a bit fragile, because
if a thread misses the "go" twice, another thread won't stop as expected
(because a down is missing).

Generally, semaphores are very powerful and just as error prone. That's
why higher-level synchronization primitives should be preferred, if
available.

Regards,
Tobias

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