DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

_barrier_spin(SYNCH)


_barrier_spin -- spin-wait at a barrier

Synopsis

   cc [options] -Kthread file
   

#include <synch.h>

int _barrier_spin(barrier_spin_t *barrier);

Description

_barrier_spin makes the calling thread busy-wait, or spin, at a spinning barrier until count threads reach the barrier. count is defined during initialization with _barrier_spin_init. A thread is said to have reached the barrier when it calls _barrier_spin.

When the last thread reaches the barrier, all count spinning threads are released from the barrier and allowed to resume execution. The barrier is reset after the waiting threads are released.

barrier must previously have been initialized (see barrier_spin_init(SYNCH)).

Parameters


barrier
pointer to the barrier object at which to spin

Return values

_barrier_spin returns zero for success and an error number for failure, as described below.

Errors

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

EINVAL
invalid argument specified

Usage

Because spinning barriers waste resources, most applications should use blocking barriers instead of spinning barriers. Spinning barriers should only be used when all participating threads will reach the barrier at approximately the same time.

Warnings

Spinning barriers should never be used on a single processor system.

References

Intro(SYNCH), _barrier_spin_destroy(SYNCH), _barrier_spin_init(SYNCH), barrier(SYNCH), barrier_destroy(SYNCH), barrier_init(SYNCH), barrier_wait(SYNCH)
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005