aboutsummaryrefslogtreecommitdiff
path: root/winsup/mingw/mthr_init.c
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/mingw/mthr_init.c')
-rw-r--r--winsup/mingw/mthr_init.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/winsup/mingw/mthr_init.c b/winsup/mingw/mthr_init.c
index 23f7966..5c8c8bb 100644
--- a/winsup/mingw/mthr_init.c
+++ b/winsup/mingw/mthr_init.c
@@ -52,25 +52,29 @@ DllMain (HANDLE hDllHandle /* Library instance handle. */,
{
extern CRITICAL_SECTION __mingwthr_cs;
- extern void __mingwthr_run_key_dtors (DWORD);
+ extern void __mingwthr_run_key_dtors( void );
+
+#ifdef DEBUG
+ printf ("%s: reason %d\n", __FUNCTION__, reason );
+#endif
switch (reason)
{
case DLL_PROCESS_ATTACH:
- InitializeCriticalSection (&__mingwthr_cs);
- break;
+ InitializeCriticalSection (&__mingwthr_cs);
+ break;
case DLL_PROCESS_DETACH:
- DeleteCriticalSection (&__mingwthr_cs);
+ __mingwthr_run_key_dtors();
+ DeleteCriticalSection (&__mingwthr_cs);
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
- __mingwthr_run_key_dtors (GetCurrentThreadId ());
+ __mingwthr_run_key_dtors();
break;
}
return TRUE;
}
-