Module Luv.Loop
Event loops.
See Event loops in the user guide and uv_loop_t
— Event loop in libuv.
type t
= Luv__.C.Types.Loop.t Ctypes.ptr
Binds
uv_loop_t
.
module Run_mode : sig ... end
Binds
uv_run_mode
.
val run : ?loop:t -> ?mode:Run_mode.t -> unit -> bool
Runs an event loop.
Binds
uv_run
.If
?loop
is specified, the given loop will be run. If not, this function will runLuv.Loop.default
, which is suitable for most cases.See
uv_run
for the meaning of the constants that can be specified with?mode
. The default value is`DEFAULT
.Again, see
uv_run
for information on the return value. Zero fromuv_run
corresponds tofalse
fromLuv.Loop.run
, and non-zero corresponds totrue
.This function typically should not be called by a library based on Luv. Rather, it should be called by applications.
val default : unit -> t
Returns the default event loop.
Binds
uv_default_loop
.
val init : unit -> (t, Error.t) Result.result
Allocates and initializes a new event loop.
Binds
uv_loop_init
.
val close : t -> (unit, Error.t) Result.result
Releases resources associated with an event loop.
Binds
uv_loop_close
.
val update_time : t -> unit
Updates the cached loop timestamp.
Binds
uv_update_time
.
module Option : sig ... end
Binds
uv_loop_option
.
val configure : t -> 'value Option.t -> 'value -> (unit, Error.t) Result.result
Sets a loop option.
Binds
uv_loop_configure
.
val alive : t -> bool
Indicates whether the loop is monitoring any activity.
Binds
uv_loop_alive
.
val backend_fd : t -> int option
Returns the file descriptor used for I/O polling.
Binds
uv_backend_fd
.
val backend_timeout : t -> int option
Returns the timeout used with I/O polling.
Binds
uv_backend_timeout
.
val fork : t -> (unit, Error.t) Result.result
Reinitializes libuv after a call to
fork(2)
.Binds
uv_loop_fork
.Requires libuv 1.12.0.
Feature check:
Luv.Require.(has loop_fork)
val library_shutdown : unit -> unit
Releases any state libuv is holding on to.
Binds
uv_library_shutdown
.Note especially the warnings in the libuv documentation of this function.
Requiers Luv 0.5.3 and libuv 1.38.0.
Feature check:
Luv.Require.(has library_shutdown)