BARRIER(3P) BARRIER(3P)
barrier, new_barrier, init_barrier, free_barrier - barrier functions
#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);
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.
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.
sproc(2), usinit(3P), ussetlock(3P), usunsetlock(3P), usnewlock(3P).
Upon successful completion, new_barrier returns a pointer to a barrier
struct. Otherwise, a value of 0 is returned to the calling process.
PPPPaaaaggggeeee 1111 [ Back ]
|