module Netsys_polypipe:sig
..end
exception Closed
type 'a
polypipe
val create : int -> 'a polypipe * 'a polypipe
val length : 'a polypipe -> int
val eof : 'a polypipe -> bool
val read : nonblock:bool -> 'a polypipe -> 'a option
None
means EOF. Possible Unix.unix_error
codes:EAGAIN
: the pipe is non-blocking, and there is no message in the
bufferEINTR
: a signal arrivedClosed
if the polypipe has been closed.val write : nonblock:bool -> 'a polypipe -> 'a option -> unit
None
).
Possible Unix.unix_error
codes:EAGAIN
: the pipe is non-blocking, and there is no message in the
bufferEINTR
: a signal arrivedEPIPE
: it was tried to send a message after sending None
.
Raises Closed
if the polypipe has been closed.
val close : 'a polypipe -> unit
None
.val set_read_notify : 'a polypipe -> (unit -> unit) -> unit
set_read_notify pipe f
: Sets that the function f
is called
when the pipe becomes readable (or reaches eof). Only one such
function can be registered; any previous function is
overwritten. The function will be called from a different thread.val set_write_notify : 'a polypipe -> (unit -> unit) -> unit
set_write_notify pipe f
: Sets that the function f
is called
when the pipe becomes writable (or reaches eof). Only one such
function can be registered; any previous function is
overwritten. The function will be called from a different thread.val read_descr : 'a polypipe -> Unix.file_descr
The caller has to close the descriptor after use.
Raises Closed
if the polypipe has been closed.
val write_descr : 'a polypipe -> Unix.file_descr
The caller has to close the descriptor after use.
Raises Closed
if the polypipe has been closed.
val set_exception : 'a polypipe -> exn -> unit
write
. If an exception already exists, it is not overwritten.
read
will return EOF. Readers need to test for the exceptionw with
get_exception
.
val get_exception : 'a polypipe -> exn option
module Debug:sig
..end