Next: , Previous: , Up: iklib io   [Index]


6.44.3 Handling non–blocking devices

R6RS defines the input operations on Scheme ports as properly blocking when no input data is available; this is fine when the underlying device is configured in blocking mode. Vicare extends the Scheme input/output ports to support underlying devices configured in non–blocking mode; such ports are typically the ones whose underlying device is a POSIX file or socket descriptor.

The implementation of Scheme ports read from the underlying device through a function read!; if the device is configured in non–blocking mode: read! might raise an exception with condition object type &i/o-eagain, which means: there are no available bytes, but this is not the end–of–file. This scenario corresponds to the case in which a POSIX function fails with errno set to EAGAIN or EWOULDBLOCK.

The functions extended by Vicare behave as described in this section. The extended behaviour is disabled when running with the command line --strict-r6rs: in this case the port will block as mandated by R6RS.