joyent/libuv — pull request #1304 by bnoordhuis (2014-06-02 16:33:33+00:00)
Title: unix, windows: make uv_barrier_wait() return bool

Make uv_barrier_wait() return a boolean value indicating whether this
thread was the "serializer".

From `man pthread_barrier_wait`:

Upon successful completion, the pthread_barrier_wait() function
shall return PTHREAD_BARRIER_SERIAL_THREAD for a single (arbitrary)
thread synchronized at the barrier and zero for each of the other
threads.

Exposing that information from libuv is useful because it can make
cleanup significantly easier:

if (uv_barrier_wait(&barrier) > 0)
uv_barrier_destroy(&barrier);