Boost logo

Boost Users :

From: Graham Reitz (graham.cpp_at_[hidden])
Date: 2007-06-20 17:44:20


Excellent and thanks! I completely missed boost:condition.

Graham

On 6/18/07, Tobias Schwinger <tschwinger_at_[hidden]> 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_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net