Download pSOSystem Programmer`s Reference

Transcript
pr.book Page 53 Thursday, January 28, 1999 9:18 AM
pSOSystem Programmer’s Reference
Standard pSOSystem Character I/O Interface
MinChar represents the minimum number of characters that are received to complete the read and return to the calling program. MaxTime is a timer of one-tenth
second granularity that is used to time-out burst and short term data transmissions. The four possible values for MinChar and MaxTime and their interactions are
described below.
Case A: MinChar > 0 and MaxTime > 0
In this case MaxTime serves as an inter-character timer and is activated
after the first character is received and is reset after each subsequent character input. The interaction between MinChar and MaxTime is as follows:
■
As soon as one character is received, the inter-character timer is
started.
■
If MinChar characters are received before the inter-character timer expires, the read is satisfied.
■
If the timer expires before MinChar characters are received, the characters received to that point are returned to the user.
NOTE: If MaxTime expires, at least one character is returned because the
timer is enabled only if a character was received. In this case
where MinChar > 0 and MaxTime > 0 the read blocks until the
MinChar and MaxTime mechanisms are activated by the receipt
of the first character.
Case B: MinChar > 0 and MaxTime = 0
In this case only MinChar is significant because MaxTime is set to zero. A
pending read is blocked until MinChar characters are received.
NOTE: A program that uses this case to read record based terminal I/O may
block indefinitely in the read operation.
Case C: MinChar = 0 and MaxTime > 0
In this case MaxTime no longer represents an inter-character timer but
serves as a read timer because MinChar is set to zero. It is activated as soon
as a read call is made. A read is satisfied on input of a single character or
expiration of the read timer. If no character is received within .1 x MaxTime
seconds after the read is initiated, the read returns with zero characters.
Case D: MinChar = 0 and MaxTime = 0
In this case, the return is immediate. The minimum of either the number of
characters requested or the number of characters currently available is returned without waiting for more character input.
DITI (Device Independent Terminal Interface)
4-53
4