pfuBarrier(3pf) OpenGL Performer 3.2.2 libpfutil Reference Pages
NAME
pfuBarrierCreate, pfuBarrierDestroy, pfuBarrierEnter - spin-free
multiprocess barrier routines
FUNCTION SPECIFICATION
#include <Performer/pfutil.h>
pfuBarrier * pfuBarrierCreate(usptr_t *usptr);
void pfuBarrierDestroy(pfuBarrier *b);
void pfuBarrierEnter(pfuBarrier *b, unsigned int n);
DESCRIPTION
These functions provide a rendezvous mechanism for synchronizing
processes. The API and functionality is analogous to IRIX libc's
barrier(), but the implementation uses semaphores instead of spinning,
and is therefore hundreds of times faster than barrier() when there is
contention for processors.
pfuBarrierCreate() takes a usptr_t as an argument to indicate the shared
arena from which to allocate the barrier. This should be either
Performer's semaphore arena obtained by pfGetSemaArena(), or an arena
handle obtained through a call to usinit(). If the barrier cannot be
created then NULL is returned and the system errno is set to indicate the
error.
pfuBarrierDestroy() releases all storage associated with b.
pfuBarrierEnter() takes a pointer to a previously allocated barrier
structure (as returned by pfuBarrierCreate()) and the number of
participating processes. As each process enters the barrier, it waits
(using a semaphore) until all n processes have entered, at which time all
are released and continue executing. The barrier may be reused
immediately.
NOTES
The implementation does not depend on any other part of Performer. It
uses two semaphores allocated from the semaphore arena.
There is no analogue of libc's init_barrier() to reset a barrier, since
it's nonsense.
The libpfutil source code, object code and documentation are provided as
unsupported software. Routines are subject to change in future releases.
SEE ALSO
pfGetSemaArena, usinit, oserror, pfuRendezvous, barrier
Page 1