pthread_barrier_destroy(3P)
pthread_barrier_init, pthread_barrier_wait, pthread_barrier_destroy - pthread barriers
Showing IRIX 6.5.30 (default release). Added in IRIX 6.5.30.
NAME pthread_barrier_init, pthread_barrier_wait, pthread_barrier_destroy - pthread barriers C SYNOPSIS #include <pthread.h> int pthread_barrier_init(pthread_barrier_t *barrier, const pthread_barrierattr_t *attr, unsigned count); int pthread_barrier_wait(pthread_barrier_t *barrier); int pthread_barrier_destroy(pthread_barrier_t *barrier); DESCRIPTION Barriers are a method of synchronizing multiple threads. Threads blocking on a barrier will not proceed past the barrier until all the threads using the barrier have arrived and blocked on it. pthread_barrier_init() initializes the barrier object referenced by barrier using the attributes referenced by attr. If attr is NULL then default attributes will be used. The results are undefined if called on an already initialized barrier. pthread_barrier_wait() will synchronize participating threads at the barrier referenced by barrier until the required number have called the function specifying barrier. At that time PTHREAD_BARRIER_SERIAL_THREAD will be returned to a single thread and zero to the remaining threads. If a thread blocked on a barrier receives a signal it will return to blocking on the barrier at the end of the signal handler. pthread_barrier_destroy() destroys the barrier object referenced by barrier and frees any resources associated with it. The results are undefined if it is called when any threads are blocked on the barrier. DIAGNOSTICS On success these functions return zero; otherwise an error number is returned. pthread_barrier_wait() will return PTHREAD_BARRIER_SERIAL_THREAD to a single thread. pthread_barrier_init() can return the following errors: [EINVAL] The value specified by count is zero. pthread_barrier_wait() can return the following errors: [EINVAL] The object specified by barrier in invalid. pthread_barrier_destroy() can return the following errors: [EINVAL] The object specified by barrier in invalid. SEE ALSO pthread_barrierattr_init(3P)