[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: winch trap delayed until keypress

From: Linda Walsh
Subject: Re: winch trap delayed until keypress
Date: Thu, 22 May 2014 19:26:13 -0700
User-agent: Thunderbird

Egmont Koblinger wrote:

Disclamer: this might be Linux specific, I don't know too much about
other Unixes.

SIGWINCH *does* interrupt system calls (easily causing a whole lot of
headache for many people), unless the signal is blocked or ignored (as
it is by default).  And there's a cool pselect() syscall.  Combining
these two, one can easily handle window change only when the prompt is
displayed, without race condition, and without running heavy stuff in
the handler -- this is exactly why pselect was invented, according to
my best knowledge.

The signal should be blocked by default.  That is, you don't have to
worry about syscalls being interrupted by sigwinch anywhere in bash,
except for one designated place.  When bash starts waiting for the
next user keypress, instead of a read() it should issue a pselect()
which atomically unblocks the signal and starts waiting for input.
        I think you have that backwards... pselect allows blocking
the signal.  The default behavior is 'undefined'.

        The 'pselect' call is a POSIX standard, but it would block
the signal coming in during the call -- which is the opposite of what
is wanted.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]