[Info-vax] [OT] Unix terminal drivers, was: Re: Moving away from OpenVMS
John Reagan
johnrreagan at earthlink.net
Sun May 20 13:59:23 EDT 2012
"Simon Clubley" wrote in message news:jp5gd4$khd$1 at dont-email.me...
>Unix terminal drivers have a built in timeout capability (at least the
>ones I am familiar with); the timeout is in units of 0.1 seconds.
Yep, Google "tcsetattr" and you'll find:
In noncanonical mode input is available immediately (without the user having
to type a line-delimiter character), and line editing is disabled. The
settings of MIN (c_cc[VMIN]) and TIME (c_cc[VTIME]) determine the
circumstances in which a read(2) completes; there are four distinct cases:
* MIN == 0; TIME == 0: If data is available, read(2) returns immediately,
with the lesser of the number of bytes available, or the number of bytes
requested. If no data is available, read(2) returns 0.
* MIN > 0; TIME == 0: read(2) blocks until the lesser of MIN bytes or the
number of bytes requested are available, and returns the lesser of these two
values.
* MIN == 0; TIME > 0: TIME specifies the limit for a timer in tenths of a
second. The timer is started when read(2) is called. read(2) returns either
when at least one byte of data is available, or when the timer expires. If
the timer expires without any input becoming available, read(2) returns 0.
* MIN > 0; TIME > 0: TIME specifies the limit for a timer in tenths of a
second. Once an initial byte of input becomes available, the timer is
restarted after each further byte is received. read(2) returns either when
the lesser of the number of bytes requested or MIN byte have been read, or
when the inter-byte timeout expires. Because the timer is only started after
the initial byte becomes available, at least one byte will be read.
More information about the Info-vax
mailing list