PTHREAD_BARRIER(3) | Library Functions Manual | PTHREAD_BARRIER(3) |
int
pthread_barrier_init(pthread_barrier_t * restrict barrier, const pthread_barrierattr_t * restrict attr, unsigned int count);
int
pthread_barrier_destroy(pthread_barrier_t *barrier);
int
pthread_barrier_wait(pthread_barrier_t *barrier);
The pthread_barrier_destroy() function causes the resources allocated to barrier to be released. No threads should be blocked on barrier.
The pthread_barrier_wait() function causes the current thread to wait on the barrier specified. Once as many threads as specified by the count parameter to the corresponding pthread_barrier_init() call have called pthread_barrier_wait(), all threads will wake up, return from their respective pthread_barrier_wait() calls and continue execution.
If successful, pthread_barrier_destroy() will return zero. Otherwise an error value will be returned.
If successful, pthread_barrier_wait() will return zero for all waiting threads except for one. One thread will receive status 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.
The pthread_barrier_destroy() function may fail if:
The pthread_barrier_wait() function may fail if:
July 8, 2010 | NetBSD 6.1 |