_barrier_spin(3synch)


_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(3synch)).

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(3synch), _barrier_spin_destroy(3synch), _barrier_spin_init(3synch), barrier(3synch), barrier_destroy(3synch), barrier_init(3synch), barrier_wait(3synch)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004