* thread.cc (pthread::exit): Create dummy tls structure to hold _main_tls

contents if we've asked _main_tls to exit.
This commit is contained in:
Christopher Faylor 2011-08-24 14:23:38 +00:00
parent c9e60624d3
commit 8323a37d5d
2 changed files with 15 additions and 1 deletions

View 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> 2011-08-23 Corinna Vinschen <corinna@vinschen.de>
* poll.cc (poll): Don't return prematurely if invalid fds have been * poll.cc (poll): Don't return prematurely if invalid fds have been

View File

@ -517,8 +517,17 @@ pthread::exit (void *value_ptr)
if (InterlockedDecrement (&MT_INTERFACE->threadcount) == 0) if (InterlockedDecrement (&MT_INTERFACE->threadcount) == 0)
::exit (0); ::exit (0);
else else
{
if (cygtls == _main_tls)
{
_cygtls *dummy = (_cygtls *) malloc (sizeof (_cygtls));
*dummy = *_main_tls;
_main_tls = dummy;
_main_tls->initialized = false;
}
ExitThread (0); ExitThread (0);
} }
}
int int
pthread::cancel () pthread::cancel ()