diff options
author | Christopher Faylor <me@cgf.cx> | 2006-02-24 21:40:28 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2006-02-24 21:40:28 +0000 |
commit | ad37df481483fd8f0e6212f828b2e9c03b625f74 (patch) | |
tree | cd5082a1854651139cc4d823a8b39556034c2faa /winsup/cygwin/sigproc.cc | |
parent | ff20d12a66a6f4e80569f1d7101a2d4e138d0d57 (diff) | |
download | cygnal-ad37df481483fd8f0e6212f828b2e9c03b625f74.tar.gz cygnal-ad37df481483fd8f0e6212f828b2e9c03b625f74.tar.bz2 cygnal-ad37df481483fd8f0e6212f828b2e9c03b625f74.zip |
* sigproc.cc (sigheld): Define new variable.
(sig_dispatch_pending): Don't check sigq since that's racy.
(sig_send): Set sigheld flag if __SIGHOLD is specified, reset it if __SIGNOHOLD
is specified. Ignore flush signals if we're holding signals.
Diffstat (limited to 'winsup/cygwin/sigproc.cc')
-rw-r--r-- | winsup/cygwin/sigproc.cc | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index ab8699128..cd8278ee2 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -64,6 +64,7 @@ HANDLE NO_COPY sigCONT; // Used to "STOP" a process Static cygthread *hwait_sig; Static HANDLE wait_sig_inited; // Control synchronization of // message queue startup +Static bool sigheld; // True if holding signals Static int nprocs; // Number of deceased children Static char cprocs[(NPROCS + 1) * sizeof (pinfo)];// All my children info @@ -440,7 +441,7 @@ sigpending (sigset_t *mask) void __stdcall sig_dispatch_pending (bool fast) { - if (exit_state || &_my_tls == _sig_tls || !sigq.start.next) + if (exit_state || &_my_tls == _sig_tls) { #ifdef DEBUGGING sigproc_printf ("exit_state %d, cur thread id %p, _sig_tls %p, sigq.start.next %p", @@ -512,8 +513,22 @@ sigproc_terminate (exit_states es) int __stdcall sig_send (_pinfo *p, int sig) { - if (sig == __SIGNOHOLD) - SetEvent (sigCONT); + if (sig == __SIGHOLD) + sigheld = true; + else if (!sigheld) + /* nothing */; + else if (sig != __SIGNOHOLD && sig != __SIGFLUSH && sig != __SIGFLUSHFAST) + { +#ifdef DEBUGGING + system_printf ("internal signal sent while signals are on hold"); +#endif + return -1; + } + else + { + SetEvent (sigCONT); + sigheld = false; + } siginfo_t si = {0}; si.si_signo = sig; si.si_code = SI_KERNEL; |