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
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
bind t f also fails, with the same exception.
val ignore_result : 'a t -> unit
ignore_result t is like Pervasives.ignore t except that: if
t already failed, it raises the exception now, if
t is sleeping and fails later, the exception will be given to async_exception_hook.
val fail : exn -> 'a t
fail e is a thread that fails with the exception
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 -> 'a 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
close ch closes the given channel. It performs all pending actions, flushes it and closes it.
write_value oc ?flags x marshals the value
open_connection addr opens a connection to the given address and returns two channels for using it.
val establish_server : ?backlog:int -> Batteries.Unix.sockaddr -> ( (input_channel * output_channel) -> unit ) -> server
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.
val shutdown_server : server -> unit
shutdown_server server will shutdown
val log : ?exn:exn -> ?location:(string * int * int) -> logger:logger -> level:level -> string -> unit t
log ?exn ?location logger level message logs a message using
logger. If exn is provided, then its string representation (= Printexc.to_string exn) will be append to the message, and if possible the back trace will also be logged. Location contains the location of the logging directive, it is of the form (file_name, line, column).
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 Timeout.
choose l behaves as the first thread in
l to terminate. If several threads are already terminated, one is chosen at random.
pick l is the same as
choose, except that it cancels all sleeping threads when one terminates.
nchoose l returns the value of all that have successfully terminated. If all threads are sleeping, it waits for at least one to terminates. If one the threads of
nchoose fails with the same exception.
val at_exit : ( unit -> unit t ) -> unit
at_exit fn will call fn on program exit.