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>2008-11-28 19:41:54 +0300
committerChristopher Faylor <me@cgf.cx>2008-11-28 19:41:54 +0300
commitd92ed436e3710ff3455b7a5e3f228bada39ae0bb (patch)
tree38d8d1c0ef57c993beb91620248499eaa5360950 /winsup/cygwin
parentfa421c7a751ebde2acc62dcf032fb3b36f698db1 (diff)
* exceptions.cc (sigpacket::process): Rework previous change. tls could still
become NULL.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/exceptions.cc30
2 files changed, 21 insertions, 14 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 22fc998de..5df030378 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,8 @@
+2008-11-28 Christopher Faylor <me+cygwin@cgf.cx>
+
+ * exceptions.cc (sigpacket::process): Rework previous change. tls
+ could still become NULL.
+
2008-11-28 Christian Franke <franke@computer.org>
* dir.cc (readdir_worker): Initialize dirent.d_type and __d_unused1.
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index 35aea1591..5a94a13a4 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -1191,9 +1191,7 @@ sigpacket::process ()
else
handler = NULL;
- bool tls_was_null = !tls;
- if (tls_was_null)
- tls = _main_tls;
+ _cygtls *use_tls = tls ?: _main_tls;
if (si.si_signo == SIGKILL)
goto exit_sig;
@@ -1206,10 +1204,14 @@ sigpacket::process ()
bool insigwait_mask;
if ((masked = ISSTATE (myself, PID_STOPPED)))
insigwait_mask = false;
- else if (tls_was_null)
- insigwait_mask = !handler && (tls = _cygtls::find_tls (si.si_signo));
- else
+ else if (tls)
insigwait_mask = sigismember (&tls->sigwait_mask, si.si_signo);
+ else
+ {
+ insigwait_mask = !handler && (tls = _cygtls::find_tls (si.si_signo));
+ if (tls)
+ use_tls = tls;
+ }
if (insigwait_mask)
goto thread_specific;
@@ -1218,7 +1220,7 @@ sigpacket::process ()
/* nothing to do */;
else if (sigismember (mask, si.si_signo))
masked = true;
- else
+ else if (tls)
masked = sigismember (&tls->sigmask, si.si_signo);
if (masked)
@@ -1269,7 +1271,7 @@ sigpacket::process ()
if (handler == (void *) SIG_ERR)
goto exit_sig;
- tls->set_siginfo (this);
+ use_tls->set_siginfo (this);
goto dosig;
stop:
@@ -1282,7 +1284,7 @@ stop:
dosig:
/* Dispatch to the appropriate function. */
sigproc_printf ("signal %d, about to call %p", si.si_signo, handler);
- rc = setup_handler (si.si_signo, handler, thissig, tls);
+ rc = setup_handler (si.si_signo, handler, thissig, use_tls);
done:
if (continue_now)
@@ -1291,10 +1293,10 @@ done:
return rc;
thread_specific:
- tls->sig = si.si_signo;
- tls->set_siginfo (this);
+ use_tls->sig = si.si_signo;
+ use_tls->set_siginfo (this);
sigproc_printf ("releasing sigwait for thread");
- SetEvent (tls->event);
+ SetEvent (use_tls->event);
goto done;
exit_sig:
@@ -1303,11 +1305,11 @@ exit_sig:
CONTEXT c;
c.ContextFlags = CONTEXT_FULL;
GetThreadContext (hMainThread, &c);
- tls->copy_context (&c);
+ use_tls->copy_context (&c);
si.si_signo |= 0x80;
}
sigproc_printf ("signal %d, about to call do_exit", si.si_signo);
- tls->signal_exit (si.si_signo); /* never returns */
+ use_tls->signal_exit (si.si_signo); /* never returns */
}
/* Cover function to `do_exit' to handle exiting even in presence of more