pthread_barrierattr_init(3P)pthread_barrierattr_init(3P)NAME
pthread_barrierattr_init, pthread_barrierattr_setpshared,
pthread_barrierattr_getpshared, pthread_barrierattr_destroy - barrier
attributes
C SYNOPSIS
#include <pthread.h>
int pthread_barrierattr_init(pthread_barrierattr_t *attr);
int pthread_barrierattr_setpshared(pthread_barrierattr_t *attr,
int pshared);
int pthread_barrierattr_getpshared(pthread_barrierattr_t *attr,
int * pshared);
int pthread_barrierattr_destroy(pthread_barrierattr_t *attr);
DESCRIPTIONpthread_barrierattr_init() will initialize the barrier attribute object
referenced by attr with default values. By default an attribute object
will be set to PTHREAD_PROCESS_PRIVATE.
pthread_barrierattr_getpshared() will store the value of the process-
shared attribute of the attribute object attr into pshared.
pthread_barrierattr_setpshared() will set the process-shared attribute of
the initialized attribute object attr to the value of pshared.
The process-shared attribute should be set to PTHREAD_PROCESS_SHARED to
allow any pthread to operate on a barrier initialized with the attribute
object and that has access to the memory where the barrier is. It should
be set to PTHREAD_PROCESS_PRIVATE when only threads created within the
same process will operate on the barrier. The results of another process
operating on a PTHREAD_PROCESS_PRIVATE barrier are undefined.
pthread_barrierattr_destroy() will destroy the barrier attribute object
referenced by attr. The results of reusing the attribute after it has
been destroyed are undefined.
After a barrier attribute object has been used to initialize a barrier,
the action of destroying the barrier attribute will not affect any
initialized barrier.
DIAGNOSTICS
On success these functions return zero; otherwise an error number is
returned:
pthread_barrierattr_setpshared() can return the following errors:
[EINVAL] The value specified by attr is invalid.
Page 1
pthread_barrierattr_init(3P)pthread_barrierattr_init(3P)
[EINVAL] The new process-shared value is not one of
PTHREAD_PROCESS_PRIVATE or PTHREAD_PROCESS_SHARED.
pthread_barrierattr_getpshared() can return the following errors:
[EINVAL] The value specified by attr is invalid.
pthread_barrierattr_destroy() can return the following errors:
[EINVAL] The value specified by attr is invalid.
SEE ALSOpthread_barrier_init(3P), pthread_barrier_wait(3P).
Page 2