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/thread.cc')
-rw-r--r--winsup/cygwin/thread.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc
index 8cec7fba2..e411301cb 100644
--- a/winsup/cygwin/thread.cc
+++ b/winsup/cygwin/thread.cc
@@ -511,6 +511,7 @@ void
pthread::exit (void *value_ptr)
{
class pthread *thread = this;
+ bool is_main_tls = (cygtls == _main_tls); // Check cygtls before deleting this
// run cleanup handlers
pop_all_cleanup_handlers ();
@@ -536,7 +537,7 @@ pthread::exit (void *value_ptr)
::exit (0);
else
{
- if (cygtls == _main_tls)
+ if (is_main_tls)
{
_cygtls *dummy = (_cygtls *) malloc (sizeof (_cygtls));
*dummy = *_main_tls;