diff options
author | rpj <rpj> | 2000-01-04 10:19:28 +0000 |
---|---|---|
committer | rpj <rpj> | 2000-01-04 10:19:28 +0000 |
commit | a378d97dc9d9eadaef00a9f01816948db5f3a796 (patch) | |
tree | 654435cc0a85156c2a9b4793ab7d8e0da8424e32 /dll.c | |
parent | 27d833666dfd72cc6e74c3900d3e8e66321bea3a (diff) |
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
Diffstat (limited to 'dll.c')
-rw-r--r-- | dll.c | 25 |
1 files changed, 24 insertions, 1 deletions
@@ -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); + } } } |