Non-blocking input from a tty

cosell%bbn-unix at sri-unix.UUCP cosell%bbn-unix at sri-unix.UUCP
Wed Dec 7 11:22:55 AEST 1983


From:  Bernie Cosell <cosell at bbn-unix>

Can anyone remind if there is a way (however clunky) to do a non-blocking
read from a tty that is pretty portable?  I thought that there was some
magic I could do with pipes and signals, but I can't see a way to make it
work.  

Here's the scenario for the general case I'm interested in: to be able to
read and write from one terminal while be able to "respond" to a character
typed on another terminal; no characters must ever get lost.  The specific
case I'm working on uses just one terminal: I am using a funny (non ^s/^q)
flow control and so have to handle my own.  No real problem but I can't
figure out how to check if the terminal has said "stop" while I am in a
loop pumping output to it.

I had another peculiar query: did the folks who wrote stdio do so carefully
enough that they will never lose any characters if a signal goes off
while stdio is doing one of its reads or writes?  Again, I am trying to be
very very clean about not losing any I/ or /O and it occurred to me that if
the stdio-writers were not careful enough even using the clock could do you
in.

Thanks
   /Bernie (cosell at bbn-unix)



More information about the Comp.unix.wizards mailing list