diff options
author | cjihrig <cjihrig@gmail.com> | 2018-06-22 11:28:11 -0400 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2018-06-24 20:54:34 -0400 |
commit | 537a4baa443daea9850a8e324b5b4d7c21dd2717 (patch) | |
tree | f36565e62794a56adfa99a8511c6d2a90c466fbc /deps/uv/src/unix/signal.c | |
parent | 49e5f0a10fc3784b318842b06854b38475fc884b (diff) | |
download | android-node-v8-537a4baa443daea9850a8e324b5b4d7c21dd2717.tar.gz android-node-v8-537a4baa443daea9850a8e324b5b4d7c21dd2717.tar.bz2 android-node-v8-537a4baa443daea9850a8e324b5b4d7c21dd2717.zip |
deps: upgrade to libuv 1.21.0
Notable changes:
- Building via cmake is now supported.
PR-URL: https://github.com/libuv/libuv/pull/1850
- Stricter checks have been added to prevent watching the same
file descriptor multiple times.
PR-URL: https://github.com/libuv/libuv/pull/1851
Refs: https://github.com/nodejs/node/issues/3604
- An IPC deadlock on Windows has been fixed.
PR-URL: https://github.com/libuv/libuv/pull/1843
Fixes: https://github.com/nodejs/node/issues/9706
Fixes: https://github.com/nodejs/node/issues/7657
- uv_fs_lchown() has been added.
PR-URL: https://github.com/libuv/libuv/pull/1826
Refs: https://github.com/nodejs/node/issues/19868
- uv_fs_copyfile() sets errno on error.
PR-URL: https://github.com/libuv/libuv/pull/1881
Fixes: https://github.com/nodejs/node/issues/21329
- uv_fs_fchmod() supports -A files on Windows.
PR-URL: https://github.com/libuv/libuv/pull/1819
Refs: https://github.com/nodejs/node/issues/12803
PR-URL: https://github.com/nodejs/node/pull/21466
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'deps/uv/src/unix/signal.c')
-rw-r--r-- | deps/uv/src/unix/signal.c | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/deps/uv/src/unix/signal.c b/deps/uv/src/unix/signal.c index b9d0a56084..8da08b8680 100644 --- a/deps/uv/src/unix/signal.c +++ b/deps/uv/src/unix/signal.c @@ -54,8 +54,7 @@ static void uv__signal_unregister_handler(int signum); static uv_once_t uv__signal_global_init_guard = UV_ONCE_INIT; static struct uv__signal_tree_s uv__signal_tree = RB_INITIALIZER(uv__signal_tree); -static int uv__signal_lock_pipefd[2]; - +static int uv__signal_lock_pipefd[2] = { -1, -1 }; RB_GENERATE_STATIC(uv__signal_tree_s, uv_signal_s, tree_entry, @@ -64,7 +63,7 @@ RB_GENERATE_STATIC(uv__signal_tree_s, static void uv__signal_global_reinit(void); static void uv__signal_global_init(void) { - if (!uv__signal_lock_pipefd[0]) + if (uv__signal_lock_pipefd[0] == -1) /* pthread_atfork can register before and after handlers, one * for each child. This only registers one for the child. That * state is both persistent and cumulative, so if we keep doing @@ -74,15 +73,11 @@ static void uv__signal_global_init(void) { if (pthread_atfork(NULL, NULL, &uv__signal_global_reinit)) abort(); - if (uv__make_pipe(uv__signal_lock_pipefd, 0)) - abort(); - - if (uv__signal_unlock()) - abort(); + uv__signal_global_reinit(); } -static void uv__signal_global_reinit(void) { +UV_DESTRUCTOR(static void uv__signal_global_fini(void)) { /* We can only use signal-safe functions here. * That includes read/write and close, fortunately. * We do all of this directly here instead of resetting @@ -90,11 +85,26 @@ static void uv__signal_global_reinit(void) { * uv__signal_global_once_init is only called from uv_loop_init * and this needs to function in existing loops. */ - uv__close(uv__signal_lock_pipefd[0]); - uv__signal_lock_pipefd[0] = -1; - uv__close(uv__signal_lock_pipefd[1]); - uv__signal_lock_pipefd[1] = -1; - uv__signal_global_init(); + if (uv__signal_lock_pipefd[0] != -1) { + uv__close(uv__signal_lock_pipefd[0]); + uv__signal_lock_pipefd[0] = -1; + } + + if (uv__signal_lock_pipefd[1] != -1) { + uv__close(uv__signal_lock_pipefd[1]); + uv__signal_lock_pipefd[1] = -1; + } +} + + +static void uv__signal_global_reinit(void) { + uv__signal_global_fini(); + + if (uv__make_pipe(uv__signal_lock_pipefd, 0)) + abort(); + + if (uv__signal_unlock()) + abort(); } @@ -103,7 +113,6 @@ void uv__signal_global_once_init(void) { } - static int uv__signal_lock(void) { int r; char data; |