[comp.unix.programmer] Questions about TCSETA[WF] ioctls

john@jwt.UUCP (John Temples) (06/12/91)

I have an application which sets up the tty with VMIN=0 and
periodically checks the keyboard for input by looking for a non-zero
return value from read().  Upon receipt of a keystroke, one of two
things happens: a screenful of data is displayed, or the tty is
switched to VMIN=1 and a few characters of input are read from the
user.

Initially, I was using TCSETAW to switch to VMIN=1.  Users experienced
problems with the console locking up when doing something like

<key that produces output>
<another key that produces output before the last one finishes>
<Control-S>

It took an interrupt character to unlock the keyboard.  It appeared as
though the lockup was occurring within the TCSETAW ioctl.  So I changed
it to a TCSETA ioctl, thinking this would eliminate the lockup, since I
was taking away the "wait" portion of the ioctl.  Sure enough, the
lockup went away, but a new problem appeared.  Sometimes when a user
pressed a key which required further input, they would see the first one or
two prompts go by, as though they had pressed return at those.  It
appeared as though there was some lag in getting the tty into VMIN=1
mode.  Can anyone shed some light on how these ioctls work, or point me
to a reference which is more in-depth than the four sentences on the
termio(7) man page?
-- 
John W. Temples -- john@jwt.UUCP (uunet!jwt!john)