summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/sigproc.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2014-11-28 20:46:13 +0000
committerCorinna Vinschen <corinna@vinschen.de>2014-11-28 20:46:13 +0000
commit26158dc3e9c20fc0488944f0c3eefdc19255e7da (patch)
tree93f7cb9eab294721a54e3892e5e81be7791c0544 /winsup/cygwin/sigproc.cc
parentc2f50c4099b5b3db7dca5797bde8c5886d999c36 (diff)
downloadcygnal-26158dc3e9c20fc0488944f0c3eefdc19255e7da.tar.gz
cygnal-26158dc3e9c20fc0488944f0c3eefdc19255e7da.tar.bz2
cygnal-26158dc3e9c20fc0488944f0c3eefdc19255e7da.zip
* cygheap.cc (init_cygheap::init_tls_list): Accommodate threadlist
having a new type threadlist_t *. Convert commented out code into an #if 0. Create thread mutex. Explain why. (init_cygheap::remove_tls): Drop timeout value. Always wait infinitely for tls_sentry. Return mutex HANDLE of just deleted threadlist entry. (init_cygheap::find_tls): New implementation taking tls pointer as search parameter. Return threadlist_t *. (init_cygheap::find_tls): Return threadlist_t *. Define ix as auto variable. Drop exception handling since crash must be made impossible due to correct synchronization. Return with locked mutex. * cygheap.h (struct threadlist_t): Define. (struct init_cygheap): Convert threadlist to threadlist_t type. (init_cygheap::remove_tls): Align declaration to above change. (init_cygheap::find_tls): Ditto. (init_cygheap::unlock_tls): Define. * cygtls.cc (_cygtls::remove): Unlock and close mutex when finishing. * exceptions.cc (sigpacket::process): Lock _cygtls area of thread before accessing it. * fhandler_termios.cc (fhandler_termios::bg_check): Ditto. * sigproc.cc (sig_send): Ditto. * thread.cc (pthread::exit): Ditto. Add comment. (pthread::cancel): Ditto.
Diffstat (limited to 'winsup/cygwin/sigproc.cc')
-rw-r--r--winsup/cygwin/sigproc.cc24
1 files changed, 18 insertions, 6 deletions
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index c53efccc1..12f61d2fb 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -608,7 +608,11 @@ sig_send (_pinfo *p, siginfo_t& si, _cygtls *tls)
else if (si.si_signo == __SIGPENDING)
pack.mask = &pending;
else if (si.si_signo == __SIGFLUSH || si.si_signo > 0)
- pack.mask = tls ? &tls->sigmask : &_main_tls->sigmask;
+ {
+ threadlist_t *tl_entry = cygheap->find_tls (tls ? tls : _main_tls);
+ pack.mask = tls ? &tls->sigmask : &_main_tls->sigmask;
+ cygheap->unlock_tls (tl_entry);
+ }
else
pack.mask = NULL;
@@ -1259,9 +1263,12 @@ wait_sig (VOID *)
continue;
sigset_t dummy_mask;
+ threadlist_t *tl_entry;
if (!pack.mask)
{
+ tl_entry = cygheap->find_tls (_main_tls);
dummy_mask = _main_tls->sigmask;
+ cygheap->unlock_tls (tl_entry);
pack.mask = &dummy_mask;
}
@@ -1276,11 +1283,16 @@ wait_sig (VOID *)
strace.activate (false);
break;
case __SIGPENDING:
- *pack.mask = 0;
- unsigned bit;
- while ((q = q->next))
- if (pack.sigtls->sigmask & (bit = SIGTOMASK (q->si.si_signo)))
- *pack.mask |= bit;
+ {
+ unsigned bit;
+
+ *pack.mask = 0;
+ tl_entry = cygheap->find_tls (pack.sigtls);
+ while ((q = q->next))
+ if (pack.sigtls->sigmask & (bit = SIGTOMASK (q->si.si_signo)))
+ *pack.mask |= bit;
+ cygheap->unlock_tls (tl_entry);
+ }
break;
case __SIGHOLD:
sig_held = true;