pthread_barrier_init() returns zero after completing successfully. Any other return value indicates that an error occurred. If the following condition occurs, the function fails and returns the corresponding value.
EINVAL
Description:The value specified by count is equal to 0, or the value specified by attr is invalid
EAGAIN
Description:The system lacks the necessary resources to initialize another barrier.
ENOMEM
Description:Insufficient memory exists to initialize the barrier.
EBUSY
Description:There was an attempt to destroy a barrier while it is in use (for example, while being used in a pthread_barrier_wait() call) by another thread.