BARRIER(3P) BARRIER(3P) NAME barrier, new_barrier, init_barrier, free_barrier - barrier functions C SYNOPSIS #include <ulocks.h> barrier_t *new_barrier (usptr_t *handle); void free_barrier (barrier_t *b); void init_barrier (barrier_t *b); void barrier (barrier_t *b, unsigned n); DESCRIPTION These routines provide a simple rendezvous mechanism for shared address processes. new_barrier takes a usptr_t as an argument to indicate the shared arena from which to allocate the barrier. The usptr_t is a previously allocated handle obtained through a call to usinit(3P). The barrier function takes a pointer to a previously allocated and initialized barrier structure (as returned by new_barrier) and the number of processes/sub-tasks to wait for. As each process enters the barrier, it spins (busy wait) until all n processes enter the barrier. At that time all are released and continue executing. The barrier function currently does not support greater than 256 waiters. free_barrier releases all storage associated with b. init_barrier resets the barrier to its default state. new_barrier will fail if one or more of the following are true: [ENOMEM] There is not enough space to allocate a barrier structure. [ENOMEM] It is not possible to allocate a lock. barrier will fail if the following is true: [EPROCLIM] It is instructed to wait for more than 256 processes. SEE ALSO sproc(2), usinit(3P), ussetlock(3P), usunsetlock(3P), usnewlock(3P). DIAGNOSTICS Upon successful completion, new_barrier returns a pointer to a barrier struct. Otherwise, a value of 0 is returned to the calling process. Page 1