windows: don't use atexit for cleaning up the threadpool
If libuv is loaded as a DLL and is later unloaded deadlocks can happen when running atexit handlers, so we can't use synchronization priomitives or join threads there. For reference see https://github.com/saghul/pyuv/issues/171
This commit is contained in:
parent
645e2a2855
commit
c8abb29f68
@ -108,7 +108,8 @@ static void post(QUEUE* q) {
|
||||
}
|
||||
|
||||
|
||||
static void cleanup(void) {
|
||||
#ifndef _WIN32
|
||||
UV_DESTRUCTOR(static void cleanup(void)) {
|
||||
unsigned int i;
|
||||
|
||||
if (initialized == 0)
|
||||
@ -130,6 +131,7 @@ static void cleanup(void) {
|
||||
nthreads = 0;
|
||||
initialized = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void init_once(void) {
|
||||
@ -167,7 +169,6 @@ static void init_once(void) {
|
||||
abort();
|
||||
|
||||
initialized = 1;
|
||||
atexit(cleanup);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user