diff options
Diffstat (limited to 'winsup/cygwin/init.cc')
-rw-r--r-- | winsup/cygwin/init.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/winsup/cygwin/init.cc b/winsup/cygwin/init.cc index 525ec29..2e08f11 100644 --- a/winsup/cygwin/init.cc +++ b/winsup/cygwin/init.cc @@ -35,6 +35,13 @@ WINAPI dll_entry (HANDLE h, DWORD reason, void *static_load) case DLL_PROCESS_DETACH: break; case DLL_THREAD_DETACH: + pthread *thisthread = (pthread *) TlsGetValue ( + user_data->threadinterface->thread_self_dwTlsIndex); + if (thisthread) { + /* Some non-pthread call created this thread, + * but we need to clean it up */ + thisthread->exit(0); + } #if 0 // FIXME: REINSTATE SOON waitq *w; if ((w = waitq_storage.get ()) != NULL) |