* 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.
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user