diff options
author | Chris Robinson <[email protected]> | 2014-04-17 00:56:02 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-04-17 00:56:02 -0700 |
commit | e5d39a5f4c871183c7e409abff3c3a6d6c40bf17 (patch) | |
tree | 3b33b86e7ea81de8990b3bec78f7668a6fba7324 /Alc/ALc.c | |
parent | c3b1c31d9b530e64e84805435784ec53eb5ea745 (diff) |
Don't use DllMain to call altss destructors
Diffstat (limited to 'Alc/ALc.c')
-rw-r--r-- | Alc/ALc.c | 22 |
1 files changed, 5 insertions, 17 deletions
@@ -786,34 +786,22 @@ static void alc_init(void); static void alc_deinit(void); static void alc_deinit_safe(void); -UIntMap TlsDestructor; +extern UIntMap TlsDestructors; #ifndef AL_LIBTYPE_STATIC -BOOL APIENTRY DllMain(HINSTANCE hModule,DWORD ul_reason_for_call,LPVOID lpReserved) +BOOL APIENTRY DllMain(HINSTANCE hModule, DWORD reason, LPVOID lpReserved) { - ALsizei i; - - // Perform actions based on the reason for calling. - switch(ul_reason_for_call) + switch(reason) { case DLL_PROCESS_ATTACH: /* Pin the DLL so we won't get unloaded until the process terminates */ GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_PIN | GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (WCHAR*)hModule, &hModule); - InitUIntMap(&TlsDestructor, ~0); + InitUIntMap(&TlsDestructors, ~0); alc_init(); break; case DLL_THREAD_DETACH: - LockUIntMapRead(&TlsDestructor); - for(i = 0;i < TlsDestructor.size;i++) - { - void *ptr = altss_get(TlsDestructor.array[i].key); - altss_dtor_t callback = (altss_dtor_t)TlsDestructor.array[i].value; - if(ptr && callback) - callback(ptr); - } - UnlockUIntMapRead(&TlsDestructor); break; case DLL_PROCESS_DETACH: @@ -821,7 +809,7 @@ BOOL APIENTRY DllMain(HINSTANCE hModule,DWORD ul_reason_for_call,LPVOID lpReserv alc_deinit(); else alc_deinit_safe(); - ResetUIntMap(&TlsDestructor); + ResetUIntMap(&TlsDestructors); break; } return TRUE; |