
Michael Glassford <glassfordm <at> hotmail.com> writes:
Actually, to get enough threads to reenter barrier while some threads are still inside, you need fresh threads on the next barrier. IOW, threads A, B and C wait on barrier. A gets through and spawns B' and C'. Then A, B' and C' wait on barrier, get though, and leave B and C stuck on condition wait forever.
True, I realize that. Or you could simply create a barrier that blocks until it reaches, say, 5 threads and then send 10 threads through it. In a worst case scenario, 4 of the first 5 threads to wait on the barrier could get stuck there permanently.
Is it possible to create a barrier that waits for a set of threads before permitting them to continue, rather than a count of threads? Perhaps a thread_group is a safer layer at which to implement a barrier... Matt (Adding extra lines at the end to make gmane let this through...)