From 8f8eeb70ba7354749c78bc5013eeb12f4c18fba0 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sun, 31 Mar 2013 12:35:44 +0000 Subject: * child_info.h (cygheap_exec_info::sigmask): Declare new field. * cygheap.cc (init_cygheap::find_tls): Rename threadlist_ix -> ix. Only take one pass through thread list, looking for eligible threads to signal. Set a new param indicating that function has found a sigwait* mask. * cygheap.h (init_cygheap::find_tls): Reflect new parameter. * dcrt0.cc (parent_sigmask): New variable. (child_info_spawn::handle_spawn): Save parent's signal mask here. (dll_crt0_1): Restore parent's signal mask to tls sigmask as appropriate. Call sig_dispatch_pending to flush signal queue when we can finally do something with signals. * exceptions.cc (sigpacket::process): Avoid attempting to handle signals if we haven't finished initializing. Rely on the fact that find_tls will do mask checking and don't do it again. Delete ill-named 'dummy' variable. * sigproc.cc (cygheap_exec_info::alloc): Save calling thread's signal mask in new sigmask field. (wait_sig): Try to debug when WFSO fails and DEBUGGING is defined. * thread.cc (pthread::set_tls_self_pointer): Make this a true automatic method rather than inexplicably relying on a thread parameter. (pthread::thread_init_wrapper): Accommodate set_tls_self_pointer change to non-static. Initialize sigmask before setting tid or suffer signal races. * ehread.h (pthread::set_tls_self_pointer): Make non-static, delete parameter. --- winsup/cygwin/sigproc.cc | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'winsup/cygwin/sigproc.cc') diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index 015cbaf2b..4bf6f5630 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -835,9 +835,12 @@ child_info_spawn::child_info_spawn (child_info_types chtype, bool need_subproc_r cygheap_exec_info * cygheap_exec_info::alloc () { - return (cygheap_exec_info *) ccalloc_abort (HEAP_1_EXEC, 1, - sizeof (cygheap_exec_info) - + (nprocs * sizeof (children[0]))); + cygheap_exec_info *res = + (cygheap_exec_info *) ccalloc_abort (HEAP_1_EXEC, 1, + sizeof (cygheap_exec_info) + + (nprocs * sizeof (children[0]))); + res->sigmask = _my_tls.sigmask; + return res; } void @@ -1237,7 +1240,6 @@ pending_signals::add (sigpacket& pack) if (se->si.si_signo) return; *se = pack; - se->mask = &pack.sigtls->sigmask; se->next = NULL; if (end) end->next = se; @@ -1365,7 +1367,12 @@ wait_sig (VOID *) lock_process::force_release (pack.sigtls); ForceCloseHandle1 (h, exit_thread); if (res != WAIT_OBJECT_0) - system_printf ("WaitForSingleObject(%p) for thread exit returned %u", h, res); + { +#ifdef DEBUGGING + try_to_debug(); +#endif + system_printf ("WaitForSingleObject(%p) for thread exit returned %u", h, res); + } } break; } -- cgit v1.2.3