pthread_barrier_destroy, pthread_barrier_init, pthread_barrier_wait: destroy, initialize or wait on a barrier object
#include <pthread.h>
A barrier is used to synchronize multiple threads at a specific point in the program. A typical application might be dividing up a data collection and assigning one thread to each part of the data. When all data is processed, all threads synchronize and the processed data can be passed on as a whole.
pthread_barrier_init() creates and initializes the barrier specified by the attributes, with the expected threads count, returning zero if successful.
pthread_barrier_destroy will destroy the barrier and release any resources. It returns zero if successful.
pthread_barrier_wait synchronizes count threads at the barrier, releasing them all when all have arrived. The final thread returns PTHREAD_BARRIER_SERIAL_THREAD.
pthread_barrier_init():
pthread_barrier_destroy(), pthread_barrier_wait():
The value specified is invalid.
EBUSY
pthread_barrier_destroy():