package lwt_eio
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=569e0c4aca057eeed2d2c272642baf16cb7a7266a5c197bdfa2f33e84e8ed4e4
sha512=e7534a9810fbdf12bc36bc67c885e45bf0ad19cbbf9df435b08c0ba6188ad8e52642d6a10b570a762e07756ac393fe5c5e337d5bccec4fb517415c7609e00b6a
doc/lwt_eio/Lwt_eio/index.html
Module Lwt_eioSource
with_event_loop ~clock fn starts an Lwt event loop running and then executes fn t. When that finishes, the event loop is stopped.
run_eio fn allows running Eio code from within a Lwt function. It runs fn () in a new Eio fiber and returns a promise for the result. If the returned promise is cancelled, it will cancel the Eio fiber. The new fiber is attached to the Lwt event loop's switch and will also be cancelled if the function passed to with_event_loop returns.
run_lwt fn allows running Lwt code from within an Eio function. It runs fn () to create a Lwt promise and then awaits it. If the Eio fiber is cancelled, the Lwt promise is cancelled too.
notify () causes Lwt_engine.iter to return, indicating that the event loop should run the hooks and resume yielded threads. Ideally, you should call this when an Eio fiber wakes up a Lwt thread, e.g. by resolving a Lwt promise. In most cases however this isn't really needed, since Lwt_unix.yield is deprecated and Lwt.pause will call this automatically.