Signal handling tune up.

Christopher Faylor
Tue Aug 19 00:58:00 GMT 2003

On Mon, Aug 18, 2003 at 08:17:36PM -0400, Pierre A. Humblet wrote:
>This is just an observation, about sig_handle (int sig, bool thisproc)
>The thisproc argument is set to "rc != 2" in the sigthread. However
>it is possible for several signals to occur simultaneously and a
>signal can be processed with rc == 2 even when generated by the 
>current process (or conversely). This could cause a SIGINT to be 
>ignored (or not) when it shouldn't (something like that was discussed
>on the list recently).
>I don't fully understand the use of thisproc and have no suggestion. 

Are you saying that that someone reported execing a process, hitting
ctrl-c, and having another process simultaneously sending CTRL-C's to
the exec'ed stub?  I have a hard time seeing how that could be a common

However, this does demonstrate a flaw in wait_sig.  It exhausts the sigtodo
array based on the last received type of signal.  So, if process a sends ctrl-c
to itself and "at the same time" process b sends ctrl-c to process a,
then the signal will be randomly processed as coming from either process a
process b.  If the signal is handled as coming from process b, process a
will never get the notification it needs.

I still have a hard time seeing how this could happen with any regularity
but it is definitely something I will fix.


More information about the Cygwin-patches mailing list