diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2020-04-22 12:24:34 +0200 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2020-04-22 12:24:36 +0200 |
commit | 72fe3543feb23ae555e08628b70a3fae4da5706c (patch) | |
tree | de8a3f9515a42dc1c8bfd92d9b62a4b6bf6c9b4e /src/threadpool.c | |
parent | b29612fe59f664d9b370dceda1060b1dc1deaff0 (diff) | |
download | libuv-72fe3543feb23ae555e08628b70a3fae4da5706c.tar.gz libuv-72fe3543feb23ae555e08628b70a3fae4da5706c.zip |
unix,win: add uv_library_shutdown()
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 <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Diffstat (limited to 'src/threadpool.c')
-rw-r--r-- | src/threadpool.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/threadpool.c b/src/threadpool.c index a8f433f0..0998938f 100644 --- a/src/threadpool.c +++ b/src/threadpool.c @@ -160,8 +160,8 @@ static void post(QUEUE* q, enum uv__work_kind kind) { } +void uv__threadpool_cleanup(void) { #ifndef _WIN32 -UV_DESTRUCTOR(static void cleanup(void)) { unsigned int i; if (nthreads == 0) @@ -181,8 +181,8 @@ UV_DESTRUCTOR(static void cleanup(void)) { threads = NULL; nthreads = 0; -} #endif +} static void init_threads(void) { |