Suppose one process is using extended wait, and,
while it is waiting,
the only process that could resolve the condition terminates
unexpectedly.
The waiting process will never wake up and must be
aborted. A "timeout" allows the waiting process to
detect the situation and terminate gracefully.
MPE/iX allows a process
to set a timeout. If, after a specified time, the I/O still
has not completed, the I/O intrinsic returns to the process.
If there is a complex set of
processes and message files, and they get into a state where all
the processes are waiting on FREADs
and none of them can do an FWRITE,
timeouts can help detect this deadlock.
(An example of a complex set of processes and message files is
a case in which there are processes that read from one message
file and write to another.)
Timeouts are useful
when a process must perform some time-sensitive processing
(such as updating a table every n seconds)
and, therefore, cannot wait
for long periods of time. Some tasks are both
command and time driven
(that is, display status every n seconds or when asked)
and therefore could use timeouts.
Timeouts are set (in seconds) using the FCONTROL intrinsic with a controlcode of 4,
and they are valid for both readers and writers.
Note that timeouts come into play only on EOF conditions.
If FREAD or FWRITE times out, a CCL condition code is
returned, and FCHECK returns FSERR 22, Software Time-Out.
Timeouts on terminals are valid only for the next I/O.
Timeouts on message files stay in effect
on every I/O until explicitly turned off.
(See Example B-2 in Appendix B.)