DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

barrier_wait(3synch)


barrier_wait -- wait at a blocking barrier

Synopsis

   cc [options] -Kthread file
   

#include <synch.h>

int barrier_wait(barrier_t *barrier);

Description

barrier_wait blocks the calling thread at a barrier until count threads have called it. count is defined during initialization with barrier_init. A thread is said to have ``reached the barrier'' when it calls barrier_wait.

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.

Parameters


barrier
pointer to barrier at which to wait

Return values

barrier_wait returns zero for success and an error number for failure.

Errors

If following condition is detected, barrier_wait returns the corresponding value:

EINVAL
invalid argument specified

References

Intro(3synch), barrier(3synch), barrier_destroy(3synch), barrier_init(3synch), fork(2)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004