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:
authorChristopher Faylor <me@cgf.cx>2011-08-24 18:23:38 +0400
committerChristopher Faylor <me@cgf.cx>2011-08-24 18:23:38 +0400
commit8323a37d5d8987f766001221b99395b8a7a39751 (patch)
tree402b6f4a77556b307cfbb29ab03bc050f3645008 /winsup/cygwin/thread.cc
parentc9e60624d3b6663d76ccdb43a1c33198564fb16b (diff)
* thread.cc (pthread::exit): Create dummy tls structure to hold _main_tls
contents if we've asked _main_tls to exit.
Diffstat (limited to 'winsup/cygwin/thread.cc')
-rw-r--r--winsup/cygwin/thread.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc
index 389c8fda3..953e0c9f8 100644
--- a/winsup/cygwin/thread.cc
+++ b/winsup/cygwin/thread.cc
@@ -517,7 +517,16 @@ pthread::exit (void *value_ptr)
if (InterlockedDecrement (&MT_INTERFACE->threadcount) == 0)
::exit (0);
else
- ExitThread (0);
+ {
+ if (cygtls == _main_tls)
+ {
+ _cygtls *dummy = (_cygtls *) malloc (sizeof (_cygtls));
+ *dummy = *_main_tls;
+ _main_tls = dummy;
+ _main_tls->initialized = false;
+ }
+ ExitThread (0);
+ }
}
int