pthread_barrier_destroy() 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:Indicates that the value of barrier was not valid.
EBUSY
Description:An attempt was made to destroy a barrier while it is in use (for example, while being used in a pthread_barrier_wait() by another thread.