From 72fe3543feb23ae555e08628b70a3fae4da5706c Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Wed, 22 Apr 2020 12:24:34 +0200 Subject: unix,win: add uv_library_shutdown() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make it possible to explicitly tell libuv to release any resources it's still holding onto (memory, threads, file descriptors, etc.) Before this commit, cleanup was performed in various destructors. This commit centralizes the cleanup logic, enabling the addition of `uv_library_shutdown()`, but maintains the current observable behavior of cleaning up when libuv is unloaded by means of `dlclose(3)`. Fixes: https://github.com/libuv/libuv/issues/2763 PR-URL: https://github.com/libuv/libuv/pull/2764 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Richard Lau Reviewed-By: Saúl Ibarra Corretgé --- src/unix/signal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/unix/signal.c') diff --git a/src/unix/signal.c b/src/unix/signal.c index 1e7e8ac5..1c83e095 100644 --- a/src/unix/signal.c +++ b/src/unix/signal.c @@ -77,7 +77,7 @@ static void uv__signal_global_init(void) { } -UV_DESTRUCTOR(static void uv__signal_global_fini(void)) { +void uv__signal_cleanup(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 @@ -98,7 +98,7 @@ UV_DESTRUCTOR(static void uv__signal_global_fini(void)) { static void uv__signal_global_reinit(void) { - uv__signal_global_fini(); + uv__signal_cleanup(); if (uv__make_pipe(uv__signal_lock_pipefd, 0)) abort(); -- cgit v1.2.3