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.
Indicates that the value of barrier was not valid.
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.