diff options
-rw-r--r-- | winsup/cygwin/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/cygwin/thread.cc | 11 |
2 files changed, 15 insertions, 1 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index c55014c..0eb9dcf 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -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 diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc index 389c8fd..953e0c9 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 |