On Mon, 19 Sep 2005, Andreas Kahari wrote:

> Hi,
> 
> I'm running the following simple test script:
> 
> #!/bin/ksh -x
> 
> trap 'eval $(resize)' WINCH
> 
> while true; do
>     sleep 10
> done
> 
> What I'm noticing is that the WINCH signal action is not actually
> carried out until at the end of the sleep, should the signal be sent
> during the sleep period.
> 
> I'm wondering if this is the behaviour I should expect or not.  I
> initially expected the signal to interrupt the sleep.  The SUSv3
> documentation for the sleep(1) utility says "The sleep utility shall
> take the standard action for all other signals [other than ALRM]."
> (for the ALRM signal, there is a number of things that could happen,
> which is not interesting right now).
> 
> (the WINCH signal is delivered when the terminal window changes size)
> 
> Any thoughts?

The default action for SIGWNCH is discard (see signal(3)), so the
sleep is not interrupted. If you make a little program that handles
SIGWINCH and calls sleep(3) you'll see that the signal does get
delivered immediately and the sleep gets interrupted.

Note I recently committed a fix related to SIGWINCH in ksh(1)
handling, but that change does not affect how sleep(1) behaves.

        -Otto

Reply via email to