Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
Exception raised by timeout
operation
A description of the implementation (e.g., the url of the code repository ), for logging purposes.
val return : 'a -> 'a t
return v
creates a light weight thread returning v
.
bind t f
is a thread which first waits for the thread t
to terminate and then, if the thread succeeds, behaves as the application of function f
to the return value of t
. If the thread t
fails, bind t f
also fails, with the same exception.
val fail : exn -> 'a t
fail e
is a thread that fails with the exception e
.
catch t f
is a thread that behaves as the thread t ()
if this thread succeeds. If the thread t ()
fails with some exception, catch t f
behaves as the application of f
to this exception.
val async : (unit -> unit t) -> unit
async f starts
a thread without waiting for the result.
val create_stream : unit -> 'a stream * ('a option -> unit)
create ()
returns a new stream and a push function.
get st
removes and returns the first element of the stream, if any. Will block if the stream is empty.
stream_append s1 s2
returns a stream
which returns all elements of s1
, then all elements of s2
.
val close_input : input_channel -> unit t
close ch
closes the given channel immediately.
val close_output : output_channel -> unit t
close ch
closes the given channel. It performs all pending actions, flushes it and closes it.
val read_value : input_channel -> 'a t
read_value ic
reads a marshalled value from ic
.
val write_value :
output_channel ->
?flags:Marshal.extern_flags list ->
'a ->
unit t
write_value oc ?flags x
marshals the value x
to oc
.
val open_connection : Unix.sockaddr -> (input_channel * output_channel) t
open_connection addr
opens a connection to the given address and returns two channels for using it.
val establish_server :
?backlog:int ->
Unix.sockaddr ->
(Unix.sockaddr -> (input_channel * output_channel) -> unit t) ->
server t
establish_server ?backlog sockaddr f
creates a server which will listen for incoming connections. New connections are passed to f
. Note that f
must not raise any exception. Backlog is the argument passed to Lwt_unix.listen.
log level message_formatter
logs a message at the specified level using the formatter provided.
val sleep : float -> unit t
sleep d
is a thread that remains suspended for d
seconds and then terminates.
val timeout : float -> 'a t
timeout d
is a thread that remains suspended for d
seconds and then fails with Distributed.Nonblock_io.Timeout
.
pick l
behaves as the first thread in l to terminate. If several threads are already terminated, one is chosen at random. Cancels all sleeping threads when one terminates.
val at_exit : (unit -> unit t) -> unit
at_exit fn
will call fn on program exit.