Tezos_base_unix.Event_loopThe Event_loop module provides an abstraction layer on top of promises for use in the Octez codebase.
Some components will use eio* libs, and if your library or binary uses these components, you *MUST* use this module instead of the traditional Lwt_main.run.
Retrieve the Eio environment for the current main_run being executed. The returned environment must not escape the scope of this main_run execution.
Same as env, but raises Not_initialized if called outside of main_run.
Retrieve the main switch for the current main_run being executed. The returned switch must not escape the scope of this main_run execution.
Ideally, an Eio-based function that needs to allocate resources locally should create its own switch to have better control over resource usage. In some cases, such as when a worker is spawned with Eio.Fiber.fork_daemon, you actually need a switch that will persist for the entire program's lifetime. That is where the main switch comes in handy.
Same as main_switch but raises Not_initialized if called outside of main_run execution.
on_main_run callback registers a callback to be called after initializing each main_run call.
main_run should be used as a replacement for Lwt_main.run, as it also handles `Eio` env initialization internal calls to the `Eio` event loop if ~eio is set to true (false by default).
You can't nest main_run calls.