class['a]
output_engine :(Unix.file_descr -> 'a) -> Unix.file_descr -> float -> Unixqueue.event_system ->
['a]
engine
let e = new output_engine f fd tmo
- Waits until the file descriptor
becomes writable, and calls then let x = f fd
to write to the
descriptor. The result x
is the result of the engine.
If the file descriptor does not become writable within tmo
seconds,
the resulting engine transitions to `Error Timeout
.
Use this class to construct engines writing via Unix.single_write
or
comparable I/O functions:
let write_engine fd s tmo esys =
new output_engine (fun fd ->
Unix.single_write fd s 0 (String.length s)
)
fd tmo esys
This engine returns the number of written bytes.
See also Uq_io.output_e
for a more generic way of writing with
engines.