module Lwt_main : sig..end
Main loop and event queue
This module controls the ``main-loop'' of Lwt.
val run : 'a Lwt.t -> 'a
run t calls the Lwt scheduler repeatedly until t terminates,
then returns the value returned by the thread. It t fails with
an exception, this exception is raised.
Note that you should avoid using run inside threads* The calling threads will not resume before run returns.
- Successive invocations of run are serialized: an invocation of run will not terminate before all subsequent invocations are terminated.
Note also that it is not safe to call run in a function
registered with Pervasives.at_exit, use the Lwt_main.at_exit
function of this module instead.
val yield : unit -> unit Lwt.t
yield () is a threads which suspends itself and then resumes
as soon as possible and terminates.
val enter_iter_hooks : (unit -> unit) Lwt_sequence.t
Functions that are called before the main iteration.
val leave_iter_hooks : (unit -> unit) Lwt_sequence.t
Functions that are called after the main iteration.
val exit_hooks : (unit -> unit Lwt.t) Lwt_sequence.t
Sets of functions executed just before the program exit.
Notes:* each hook is called exactly one time
- exceptions raised by hooks are ignored
val at_exit : (unit -> unit Lwt.t) -> unit
at_exit hook adds hook at the left of exit_hooks