diff options
author | Saúl Ibarra Corretgé <saghul@gmail.com> | 2016-05-17 00:25:23 +0200 |
---|---|---|
committer | Saúl Ibarra Corretgé <saghul@gmail.com> | 2016-05-17 02:28:48 +0200 |
commit | b78a7043699093c46d5d71992184f4c40ab5c4b5 (patch) | |
tree | 7ee0fc8474ae60c4be545965ae18882ef1964027 /deps/uv/src/unix/pthread-fixes.c | |
parent | f293d0b0c85b2d1b9e0d3938dd38cf1cacac6970 (diff) | |
download | android-node-v8-b78a7043699093c46d5d71992184f4c40ab5c4b5.tar.gz android-node-v8-b78a7043699093c46d5d71992184f4c40ab5c4b5.tar.bz2 android-node-v8-b78a7043699093c46d5d71992184f4c40ab5c4b5.zip |
deps: upgrade libuv to 1.9.1
Fixes: https://github.com/nodejs/node/issues/4002
Fixes: https://github.com/nodejs/node/issues/5384
Fixes: https://github.com/nodejs/node/issues/6563
Refs: https://github.com/nodejs/node/issues/2680#issuecomment-213521708
PR-URL: https://github.com/nodejs/node/pull/6796
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Diffstat (limited to 'deps/uv/src/unix/pthread-fixes.c')
-rw-r--r-- | deps/uv/src/unix/pthread-fixes.c | 70 |
1 files changed, 11 insertions, 59 deletions
diff --git a/deps/uv/src/unix/pthread-fixes.c b/deps/uv/src/unix/pthread-fixes.c index 3a71eb5aae..fb17995846 100644 --- a/deps/uv/src/unix/pthread-fixes.c +++ b/deps/uv/src/unix/pthread-fixes.c @@ -29,76 +29,28 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* Android versions < 4.1 have a broken pthread_sigmask. - * Note that this block of code must come before any inclusion of - * pthread-fixes.h so that the real pthread_sigmask can be referenced. - * */ +/* Android versions < 4.1 have a broken pthread_sigmask. */ #include <errno.h> #include <pthread.h> #include <signal.h> int uv__pthread_sigmask(int how, const sigset_t* set, sigset_t* oset) { static int workaround; + int err; if (workaround) { return sigprocmask(how, set, oset); - } else if (pthread_sigmask(how, set, oset)) { - if (errno == EINVAL && sigprocmask(how, set, oset) == 0) { - workaround = 1; - return 0; - } else { - return -1; - } } else { - return 0; - } -} - -/*Android doesn't provide pthread_barrier_t for now.*/ -#ifndef PTHREAD_BARRIER_SERIAL_THREAD - -#include "pthread-fixes.h" - -int pthread_barrier_init(pthread_barrier_t* barrier, - const void* barrier_attr, - unsigned count) { - barrier->count = count; - pthread_mutex_init(&barrier->mutex, NULL); - pthread_cond_init(&barrier->cond, NULL); - return 0; -} - -int pthread_barrier_wait(pthread_barrier_t* barrier) { - /* Lock the mutex*/ - pthread_mutex_lock(&barrier->mutex); - /* Decrement the count. If this is the first thread to reach 0, wake up - waiters, unlock the mutex, then return PTHREAD_BARRIER_SERIAL_THREAD.*/ - if (--barrier->count == 0) { - /* First thread to reach the barrier */ - pthread_cond_broadcast(&barrier->cond); - pthread_mutex_unlock(&barrier->mutex); - return PTHREAD_BARRIER_SERIAL_THREAD; + err = pthread_sigmask(how, set, oset); + if (err) { + if (err == EINVAL && sigprocmask(how, set, oset) == 0) { + workaround = 1; + return 0; + } else { + return -1; + } + } } - /* Otherwise, wait for other threads until the count reaches 0, then - return 0 to indicate this is not the first thread.*/ - do { - pthread_cond_wait(&barrier->cond, &barrier->mutex); - } while (barrier->count > 0); - - pthread_mutex_unlock(&barrier->mutex); - return 0; -} - -int pthread_barrier_destroy(pthread_barrier_t *barrier) { - barrier->count = 0; - pthread_cond_destroy(&barrier->cond); - pthread_mutex_destroy(&barrier->mutex); - return 0; -} - -#endif /* defined(PTHREAD_BARRIER_SERIAL_THREAD) */ -int pthread_yield(void) { - sched_yield(); return 0; } |