I need a SysV select()

Christoph Kuenkel ckl at uwbln.UUCP
Fri May 27 00:41:46 AEST 1988


> jpayne at cs.rochester.edu (Jonathan Payne) writes:
> {} 
> {} Hi.  The simple version of my question is, is there an equivalent
> {} function in SysV for BSD's select()?
> {} If the answer is no, here's what I am trying to do.  I want to get input
> {} from either the keyboard or from some other file description.  I don't
> {} want to sit around polling the two, because that would be ridiculous.  Is
> {} there any reasonable way to do that on SysV?  
A blocking syscall blocks a process. so, if you like to wait for several
events at the same time, you need several processes. a solution to your
problem would be to fork off a watchdog that reads the keyboard and signals
his daddy when input arrives. the parent may then collect what had been read 
using system V ipc (msges, fifos or whatever). this works quite good unless
interrupted system call are a problem. also note that signals may get lost
in system 5 (upto rel 2).
if your have several input sources, you should setup a watchdog for any source
and establish something like a protocol between the watchdogs and the main
process. the watchdogs would then send requests to the main proc containing
the data received. the main process would block on a single input queue only.
if tty input is the most interesting thing, you should modify the watchdog
so that it only reads from the tty when requested by the main process. the
main process would do a time-out read from the tty and accept watchdog input
only if a time-out occured.



More information about the Comp.unix.wizards mailing list