Signal interrupt on character ready in System V?

gwyn%brl-vld at sri-unix.UUCP gwyn%brl-vld at sri-unix.UUCP
Wed Mar 7 15:40:38 AEST 1984


From:      Doug Gwyn (VLD/VMB) <gwyn at brl-vld>

UNIX System V has no signal reserved for interrupting when input is
available.  You can achieve such a signal by forking off a reader
process that sends SIGUSR1 to its parent when it successfully gets
a character.  The same scheme works on older UNIXes too, subject to
the well-known problems of using signals for IPC.

It is also possible to do a non-blocking read from a pipe or tty
by using O_NDELAY.  Unfortunately a true EOF cannot be distinguished
from an empty input in any simple way on an O_NDELAY read().  The
non-blocking read can be used to "poll" whether input is available
as an alternative to using interrupts.  (The most probable way of
fielding interrupts would be to just set a flag for polling anyhow.)



More information about the Comp.unix mailing list