libuv/src
Ben Noordhuis 49b8a9f181 unix: signal done to last thread barrier waiter
Libuv's own thread barrier implementation signaled completion to the
first waiter that saw the threshold being reached, contrary to what
some native pthreads barrier implementations do, which is to signal
it to the _last_ waiter.

Libuv's behavior is not strictly non-conforming but it's inconvenient
because it means this snippet (that appears in the libuv documentation)
has a race condition in it:

    if (uv_barrier_wait(&barrier) > 0)
      uv_barrier_destroy(&barrier);  // can still have waiters

This issue was discovered and fixed by Ali Ijaz Sheikh, a.k.a @ofrobots,
but some refactoring introduced conflicts in his pull request and I
didn't have the heart to ask him to redo it from scratch. :-)

PR-URL: https://github.com/libuv/libuv/pull/2019
Refs: https://github.com/libuv/libuv/pull/2003
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2018-10-08 11:14:41 +02:00
..
unix unix: signal done to last thread barrier waiter 2018-10-08 11:14:41 +02:00
win win,tty: fix uv_tty_close() 2018-09-30 13:02:11 -04:00
fs-poll.c unix,win: merge handle flags 2018-06-29 22:24:52 +02:00
heap-inl.h heap: fix heap_remove() 2014-05-23 20:04:42 +04:00
inet.c win: move stdint-msvc2008.h to include/uv/ 2018-06-14 18:40:09 +02:00
queue.h unix: use QUEUE_MOVE when iterating over lists 2015-10-08 21:47:43 +02:00
threadpool.c unix,win: fix threadpool race condition 2018-10-07 15:50:57 -07:00
timer.c unix,win: merge timers implementation 2018-06-25 23:48:15 +02:00
uv-common.c src: add new error apis to prevent memory leaks 2018-07-06 19:35:21 +02:00
uv-common.h unix,win: limit concurrent DNS calls to nthreads/2 2018-08-21 10:48:24 +02:00
uv-data-getter-setters.c core: add getter/setter functions for easier ABI compat 2017-12-02 09:51:25 +01:00
version.c core: add UV_VERSION_HEX macro 2015-06-29 23:08:41 +02:00