Module Luv.Async

Inter-loop communication.

See Inter-thread communication in the user guide and uv_async_t — Async handle in libuv.

type t = [ `Async ] Handle.t

Binds uv_async_t.

Note that values of this type can be passed to functions in Luv.Handle, in addition to the functions in this module. In particular, see Luv.Handle.close.

val init : ?⁠loop:Loop.t -> (t -> unit) -> (tError.t) Result.result

Allocates and initializes an async handle.

Binds uv_async_init.

The handle should be cleaned up with Luv.Handle.close when no longer needed.

val send : t -> (unit, Error.t) Result.result

Triggers a call to the handle's callback by the handle's loop.

Binds uv_async_send.