package picos_lwt

  1. Overview
  2. Docs
Lwt interface for Picos

Install

Dune Dependency

Authors

Maintainers

Sources

picos-0.6.0.tbz
sha256=3f5a08199cf65c2dae2f7d68f3877178f1da8eabf5376e15114e5a8958087dfa
sha512=ad24910c47ce614268c4268874bb918da7f8b5f03b3ad706bbf30323635262e94ddab6be24eaebbca706bfa82c0a517d4272b396459e020c185942125c9bdb7b

doc/picos_lwt/Picos_lwt/index.html

Module Picos_lwtSource

Direct style Picos compatible interface to Lwt for OCaml 5.

This basically gives you an alternative direct style interface to programming with Lwt. All the scheduling decisions will be made by Lwt.

ℹ️ This is a system independent interface to Lwt. See Picos_lwt_unix for a Unix specific interface.

Sourceval await : 'a Lwt.t -> 'a

await promise awaits for the promise to resolve and returns the result.

⚠️ This may only be called on the main thread on which Lwt runs from inside a fiber started through run.

Sourcemodule type System = sig ... end

Signature for a module that Picos_lwt.run requires for interoperating with the system that Lwt runs on.

Sourceval run_fiber : (module System) -> Picos.Fiber.t -> (Picos.Fiber.t -> unit) -> unit Lwt.t

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

ℹ️ Inside main you can use anything implemented in Picos for concurrent programming. In particular, you only need to call run with a System module implementation at the entry point of your application.

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

Sourceval run : ?forbid:bool -> (module System) -> (unit -> 'a) -> 'a Lwt.t

run (module System) 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.

OCaml

Innovation. Community. Security.