]> sourceware.org Git - newlib-cygwin.git/commitdiff
* thread.cc (pthread::exit): Create dummy tls structure to hold _main_tls
authorChristopher Faylor <me@cgf.cx>
Wed, 24 Aug 2011 14:23:38 +0000 (14:23 +0000)
committerChristopher Faylor <me@cgf.cx>
Wed, 24 Aug 2011 14:23:38 +0000 (14:23 +0000)
contents if we've asked _main_tls to exit.

winsup/cygwin/ChangeLog
winsup/cygwin/thread.cc

index c55014c276dc5c772635e1c7226a84daf3627839..0eb9dcf6eef28ba07b726e3133d7a4e0d289c667 100644 (file)
@@ -1,3 +1,8 @@
+2011-08-24  Christopher Faylor  <me.cygwin2011@cgf.cx>
+
+       * thread.cc (pthread::exit): Create dummy tls structure to hold
+       _main_tls contents if we've asked _main_tls to exit.
+
 2011-08-23  Corinna Vinschen  <corinna@vinschen.de>
 
        * poll.cc (poll): Don't return prematurely if invalid fds have been
index 389c8fda38a033220a34925ecc69975716d399df..953e0c9f823b026f0e4498545a55538822b7ca52 100644 (file)
@@ -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
This page took 0.037744 seconds and 5 git commands to generate.