Merge pull request #2411 in HDFFV/hdf5 from ~DYOUNG/werror:darwin-barriers to develop
* commit '803d805c74466a9d736455930b17de2d9f5cb02d':
Complete the comment on thread_main(), explaining why the barrier is used.
The first implementation seemed to allow for the possibility that a thread could block at the barrier, wake and exit the barrier, re-acquire the barrier lock and increase `nentered` before the other blocked threads woke and checked `nentered % count == 0`. Then the other blocked threads would check `nentered % count == 0` and, finding it false, go back to sleep in the barrier. This new implementation waits for a looser condition to obtain so that threads don't go back to sleep in the barrier.
Test the right condition for the EBUSY return in pthread_barrier_destroy().
s/exit_failure/EXIT_FAILURE/g
Implement pthread_barrier(3) for Darwin using a counter, condition variable, and mutex. Untested.