package moonpool-lwt

  1. Overview
  2. Docs
Event loop for moonpool based on Lwt-engine (experimental)

Install

Dune Dependency

Authors

Maintainers

Sources

moonpool-0.6.tbz
sha256=3efd095c82a37bba8c7ab6a2532aee3c445ebe1ecaed84ef3ffb560bc65e7633
sha512=e4bcab82e6638299c2d0beb1dbf204f7b43379a5387418c6edff85b9bf90c13ad1bdd8eb44b69cd421268d1bc45bcf918bcf77e1c924348211ac27d6643aac78

doc/moonpool-lwt/Moonpool_lwt/IO/index.html

Module Moonpool_lwt.IOSource

IO using the Lwt event loop.

These IO operations work on non-blocking file descriptors and rely on a Lwt_engine event loop being active (meaning, Lwt_main.run is currently running in some thread).

Calling these functions must be done from a moonpool runner. A function like read will first try to perform the IO action directly (here, call Unix.read); if the action fails because the FD is not ready, then await_readable is called: it suspends the fiber and subscribes it to Lwt to be awakened when the FD becomes ready.

Sourceval read : Unix.file_descr -> bytes -> int -> int -> int

Read from the file descriptor

Sourceval await_readable : Unix.file_descr -> unit

Suspend the fiber until the FD is readable

Sourceval write_once : Unix.file_descr -> bytes -> int -> int -> int

Perform one write into the file descriptor

Sourceval await_writable : Unix.file_descr -> unit

Suspend the fiber until the FD is writable

Sourceval write : Unix.file_descr -> bytes -> int -> int -> unit

Loop around write_once to write the entire slice.

Sourceval sleep_s : float -> unit

Suspend the fiber for n seconds.

OCaml

Innovation. Community. Security.