joyent/libuv — pull request #584 by hnakamur (2012-10-09 13:46:20+00:00)
Title: uv_barrier_t implementation

This pull request implements
* uv_barrier_t
* uv_barrier_init()
* uv_barrier_destroy()
* uv_barrier_wait()

* On Unixes, it uses the native pthread_barrier_t implementation.
* On OSX and Windows, it uses the fallback implementation shown in Listing 3.10: Reusable barrier solution in [The Little Book of Semaphores](http://greenteapress.com/semaphores/)
Ideally, if uv_sem_post would take the increment count as argument, we could use more efficient Listing 3.11: Reusable barrier solution.

Note 1: I tested this pull request on MinGW with the commit https://github.com/joyent/libuv/commit/8f1ec328656c8fb792fce4a346c11141ab2cd9f9 reversed. See https://github.com/joyent/libuv/issues/583
Note 2: Windows 8 has the native [Synchronization Barriers](http://msdn.microsoft.com/en-us/library/windows/desktop/hh706897(v=vs.85%29.aspx) implementation. However it is not included in MinGW header files. So I always use fallback implementation on Windows.