cc [options] -Kthread file#include <synch.h>
int barrier_wait(barrier_t *barrier);
When the last thread reaches the barrier, all count threads are released from the barrier and are allowed to resume execution. The barrier is reset after the waiting threads are released.
barrier must previously have been initialized (see barrier_init(3synch)).
From the point of view of the caller, barrier_wait is atomic: even if interrupted by a signal or forkall (see fork(2)), barrier_wait will not return until count threads have ``reached the barrier''.
The order in which threads are released from the barrier is scheduling policy specific: Bound threads have priority over multiplexed threads; then within each category the choice of thread is scheduling-policy-specific.