Picos_lwt
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
.
await thunk
awaits for the promise returned by thunk ()
to resolve and returns the result. This should only be called from inside a fiber started through run
.
run ~sleep main
runs the main
program implemented in Picos
as a promise with Lwt
as the scheduler and given operation to sleep
. In other words, the main
program will be run as a Lwt
promise or fiber.
Calling sleep seconds
should return a cancelable promise that resolves after given number of seconds
(unless canceled).
âšī¸ Inside main
you can use anything implemented in Picos for concurrent programming. In particular, you only need to call run
with an implementation of sleep
at the entry point of your application.
The optional forbid
argument defaults to false
and determines whether propagation of cancelation is initially allowed.
A functor for building a Picos
compatible direct style interface to Lwt
with given implementation of sleep.