p
-----
The
.Fn pthread_barrier_destroy
function causes the resources allocated to
.Fa barrier
to be released.
No threads should be blocked on
.Fa barrier .
p
-----
The
.Fn pthread_barrier_wait
function causes the current thread to wait on the barrier specified.
Once as many threads as specified by the
.Fa count
parameter to the corresponding
.Fn pthread_barrier_init
call have called
.Fn pthread_barrier_wait ,
all threads will wake up, return from their respective
.Fn pthread_barrier_wait
calls and continue execution.
p
-----
The
.Fn pthread_barrierattr_getpshared
function shall obtain the value of the process-shared attribute from the
attributes object referenced by attr.
The
.Fn pthread_barrierattr_setpshared
function shall set the process-shared attribute in an initialized attributes
object referenced by attr.
----------------------------------------------------------------------------
.Sh RETURN VALUES
If successful,
.Fn pthread_barrier_init
will return zero and put the new barrier id into
.Fa barrier ,
otherwise an error number will be returned to indicate the error.
p
-----
If successful,
.Fn pthread_barrier_destroy
will return zero.
Otherwise an error value will be returned.
p
-----
If successful,
.Fn pthread_barrier_wait
will return zero for all waiting threads except for one.
One thread will receive status
.Dv PTHREAD_BARRIER_SERIAL_THREAD ,
which is intended to indicate that this thread may be used to update
shared data.
It is the responsibility of this thread to insure the visibility
and atomicity of any updates to shared data with respect to the
other threads participating in the barrier.
In the case of failure, an error value will be returned.
p
-----
If successful,
.Fn pthread_barrierattr_getpshared
shall return zero and store the value of the process-shared attribute of attr
into the object referenced by the
.Fa pshared
parameter.
Otherwise, an error number shall be returned to indicate the error.
p
-----
If successful,
.Fn pthread_barrierattr_setpshared
shall return zero;
Otherwise, an error number shall be returned to indicate the error.
----------------------------------------------------------------------------
.Sh ERRORS
The
.Fn pthread_barrier_init
function may fail if:
l -tag -width Er t Bq Er EINVAL The value specified by
.Fa count
is zero or
.Fa attr
is invalid.
.El
p
-----
The
.Fn pthread_barrier_destroy
function may fail if:
l -tag -width Er t Bq Er EBUSY The
.Fa barrier
still has active threads associated with it.
t Bq Er EINVAL The value specified by
.Fa barrier
is invalid.
.El
p
-----
The
.Fn pthread_barrier_wait
function may fail if:
l -tag -width Er t Bq Er EINVAL The value specified by
.Fa barrier
is invalid.
.El
p
-----
The
.Fn pthread_barrierattr_setpshared
function and
the
.Fn pthread_barrierattr_getpshared
function may fail if:
l -tag -width Er t Bq Er EINVAL The value specified by
.Fa attr
is invalid.
---------------------------------------------------------------------------
.Sh SEE ALSO
.Xr pthread_barrierattr 3 ,
.Xr pthread_cond 3 ,
.Xr pthread_mutex 3
.Sh STANDARDS
These functions conform to
.St -p1003.1-2001 .
.Sh BUGS
The
.Fn pthread_barrierattr_getpshared
and
.Fn pthread_barrierattr_setpshared
functions are hidden by default since only thread shared attributes
are supported.