Mail Archives: cygwin/2002/01/09/21:47:17
On Wed, Jan 09, 2002 at 12:16:04PM +1100, Robert Collins wrote:
>----- Original Message -----
>From: "Christopher Faylor" <cgf AT redhat DOT com>
>>I'm specifically trying not to do the "TRUE" thing, though, since
>>AFAICT it isn't always appropriate.
>
>If you want to SIG_IGN the signal, then it is: "When a CTRL+C signal is
>received, the control handler returns TRUE, indicating that it has
>handled the signal. Doing this prevents other control handlers from
>being called." (note that this is within this process only).
I was going back over this thread before checking in a change to see if
I'd missed something.
I just realized that I didn't address this concern. Don't know if it
matters but...
The difference between the SIG_IGN way and the "return TRUE" way is
that the SIG_IGN way stops the current process from responding to
a cygwin signal but still lets it respond to a Windows "signal". That
means that the code in ctrl_c_handle can do its job, if it has to.
If we always "return TRUE" in the exec case, then there will be some
situations where the SIGINT is not delivered to the rest of the process
group since the code in ctrl_c_handler would be short circuited.
My SIG_IGN "solution" is wrong, too, though. The SIG_IGN would be
inherited by the exec'ed process. Then the execed process would never
see a cygwin SIGINT signal.
So, I made a minor change to the signal handling code to ignore SIGINTs
when the program is a stub.
I also thought that I'd brilliantly worked around the potential
intialization signal race but after a night's sleep I realize that is
not the case. Bleah. I really don't want to use a mutex for such a
rare corner case.
Btw, if I fix this, I may well fix a problem with CTRL-C and fork() that
I've been noticing for years, too. Or, at least I'll be able to convince
myself its fixed until the next time I see the problem.
cgf
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -