@ -23,9 +23,14 @@ error (for example "connection reset by peer").
The normal usage pattern is using io_wait to know when a descriptor is
The normal usage pattern is using io_wait to know when a descriptor is
writable, and then calling iob_write until it returns 0, -1 or -3.
writable, and then calling iob_write until it returns 0, -1 or -3.
If it returns 0, terminate the loop (everything was written OK). If it
If iob_wri te returns 0, terminate the loop (everything was written OK). If it
returns -1, call io_wait again. If it returned -3, signal an error.
returns -1, call io_wait again. If it returned -3, signal an error.
The callback is supposed to behave like write(2), i.e. return the number
of bytes written, 0 for EOF, -1 for error (iob_write will return -3
then). Return -1 with errno==EAGAIN if using non-blocking I/O when we
need to wait for the next write event. iob_write will then return -1.
.SH NOTE
.SH NOTE
iob_write will continue to call your callback until it returns an error.
iob_write will continue to call your callback until it returns an error.
So if you are in a state machine, for example a web server using this
So if you are in a state machine, for example a web server using this