Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/init.cc')
-rw-r--r--winsup/cygwin/init.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/winsup/cygwin/init.cc b/winsup/cygwin/init.cc
index 525ec29b1..2e08f11f2 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)