Signal handling tune up.

Christopher Faylor cgf@redhat.com
Tue Aug 19 04:22:00 GMT 2003


On Mon, Aug 18, 2003 at 10:50:10PM -0400, Pierre A. Humblet wrote:
>At 09:05 PM 8/18/2003 -0400, Christopher Faylor wrote:
>>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.
>>
>I don't understand. The sigtodo of a signal is decremented once
>but the code immediately continues in the for loop for the next signal.
>Two signals can be processed during a cycle of the outside for (;;) and
>they will have the same rc.

Oh, right.  I was remembering a time when the inner while used to
exhaust the InterlockedDecrement.  It doesn't do that anymore but that
hardly matters because, as you say, it is possible to the current code
to be confused by "simultaneous" signals coming from the outside and
from the current process.

The only way I can think of around that is to add another an internal
sigtodo array to every process just for signals sent to myself and scan
that and the sigtodo process table.  I guess I'll implement that in the
next couple of days.

So, yes, this could be responsible for some strange signal hangs.

cgf



More information about the Cygwin-patches mailing list