From fbb4cbbe01b9ba2fa7b6c2450d2755c244d15151 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 17 Apr 2014 01:09:25 -0700 Subject: Keep TlsDestructors within threads.c This basically makes the threads implementation self-contained in threads.c and threads.h, except for the UIntMap/RWLock implementations. --- Alc/threads.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Alc/threads.c') diff --git a/Alc/threads.c b/Alc/threads.c index ca004903..cf9e5bed 100644 --- a/Alc/threads.c +++ b/Alc/threads.c @@ -205,12 +205,17 @@ int almtx_timedlock(almtx_t *mtx, const struct timespec *ts) * function pointer in a ".CRT$XLx" section (where x is a character A to Z) * ensures the CRT will call it similar to DllMain. */ -UIntMap TlsDestructors; +static UIntMap TlsDestructors = UINTMAP_STATIC_INITIALIZE; static void NTAPI altss_callback(void* UNUSED(handle), DWORD reason, void* UNUSED(reserved)) { ALsizei i; + if(reason == DLL_PROCESS_DETACH) + { + ResetUIntMap(&TlsDestructors); + return; + } if(reason != DLL_THREAD_DETACH) return; -- cgit v1.2.3