Non-blocking I/O implementation
Factor handbook ยป Input and output

Prev:ANSI C streams


On Windows and Unix, Factor implements blocking file and network streams on top of a non-blocking I/O substrate, ensuring that Factor threads will yield when performing I/O. This substrate is implemented in the io.ports vocabulary.

A port is a stream using non-blocking I/O substrate:
port

<port> ( handle class -- port )

<buffered-port> ( handle class -- port )


Input ports:
input-port

<input-port> ( handle -- input-port )


Output ports:
output-port

<output-port> ( handle -- output-port )


Global native I/O protocol:
io-backend

init-io ( -- )

init-stdio ( -- )

io-multiplex ( nanos -- )


Per-port native I/O protocol:
(wait-to-read) ( port -- )

(wait-to-write) ( port -- )


Additionally, the I/O backend must provide an implementation of the dispose generic word.