From a378d97dc9d9eadaef00a9f01816948db5f3a796 Mon Sep 17 00:00:00 2001 From: rpj Date: Tue, 4 Jan 2000 10:19:28 +0000 Subject: Main changes (see ChangeLog diff for details and attributions):- - asynchronous cancellation added - attempt to hide internal exceptions from applications - kernel32 load/free problem fixed - new tests - changes only to comments in some tests --- dll.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'dll.c') diff --git a/dll.c b/dll.c index add5832..9d59379 100644 --- a/dll.c +++ b/dll.c @@ -107,6 +107,26 @@ DllMain ( } DeleteCriticalSection(&cs); } + + if (_pthread_try_enter_critical_section == NULL) + { + /* + * If TryEnterCriticalSection is not being used, then free + * the kernel32.dll handle now, rather than leaving it until + * DLL_PROCESS_DETACH. + * + * Note: this is not a pedantic exercise in freeing unused + * resources! It is a work-around for a bug in Windows 95 + * (see microsoft knowledge base article, Q187684) which + * does Bad Things when FreeLibrary is called within + * the DLL_PROCESS_DETACH code, in certain situations. + * Since w95 just happens to be a platform which does not + * provide TryEnterCriticalSection, the bug will be + * effortlessly avoided. + */ + (void) FreeLibrary(_pthread_h_kernel32); + _pthread_h_kernel32 = 0; + } break; case DLL_THREAD_ATTACH: @@ -150,7 +170,10 @@ DllMain ( */ _pthread_processTerminate (); - (void) FreeLibrary(_pthread_h_kernel32); + if (_pthread_h_kernel32) + { + (void) FreeLibrary(_pthread_h_kernel32); + } } } -- cgit v1.2.3