Module Picos_lwt_unix

Direct style Picos compatible interface to Lwt with Lwt_unix for OCaml 5.

val run_fiber : Picos.Fiber.t -> (Picos.Fiber.t -> unit) -> unit Lwt.t

run_fiber fiber main runs the main program as the specified fiber as a promise with Lwt as the scheduler using a Lwt_unix based System module. In other words, the main program will be run as a Lwt promise or fiber.

⚠️ This may only be called on the main thread on which Lwt runs.

val run : ?forbid:bool -> (unit -> 'a) -> 'a Lwt.t

run main is equivalent to calling run_fiber with a freshly created fiber and main wrapped to capture the result of main.

The optional forbid argument defaults to false and determines whether propagation of cancelation is initially allowed.