This is the mail archive of the
mailing list for the Cygwin project.
Re: Signal handling tune up.
On Mon, Aug 18, 2003 at 08:58:32PM -0400, Christopher Faylor wrote:
>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.
Nevermind. It doesn't work the way I remembered. The while loop which
decrements sigtodo only executes once when it encounters a normal UNIX
signal (it probably should just be recoded as an if). So, this should
be a non-issue. In fact, I don't see how multiple signals coming in at
the same time would have the effect you mentioned either.