Boost logo

Boost :

From: Matthew Vogt (mvogt_at_[hidden])
Date: 2004-02-18 21:37:59


Michael Glassford <glassfordm <at> hotmail.com> writes:

> How does it know when to release all the threads? Do you mean that you
> would "register" ahead of time which threads are supposed to wait, and
> it releases them all when they have all waited on the barrier? What
> would happen if an "unregistered" thread tried to wait on the barrier?
>

Yes, you could use the group for registration - have a set of threads which
are all in the group, and each thread in the group blocks on the barrier
unless it is the last thread of the the group to reach the barrier, in which
case it releases all the other threads.

This would have to be a layer above pthread_barrier, I guess, and I don't think
the pthread barrier would actually be used to implement it... Is there any
high performance- or correctness- oriented magic in the platform's
barrier implementation?

If a thread that was not part of the thread group waited on the barrier, you
could either throw an exception, or simply allow it to also wait until the
rest of the groups threads had entered.

I'm not sure how this could be worked into the syntax, though...


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk