reader_timeout(reader, timeout, @optional f)
writer_timeout(writer, timeout, @optional f)
Set timeouts on read and write operations. Return void
.
Both reader
and writer
are streams.
Timeout
is a real number indicating the number of seconds to wait. The optional argument
f
, if specified, must be a function that takes no arguments and will be called on the timeout event.
If this call return false
, the IO operation is abandoned and the
end-of-file object is returned for readers and an exception will be raised for writers.
Otherwise the IO operation will be attempted again. Note that if the stream's timeout value has not changed, then f
will be called again immediately. F
defaults to a function that always return false
.