package miaou-core

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Miaou_helpers.Fiber_runtimeSource

Simple shared Eio runtime helpers.

The application must call init once from inside Eio_main.run to provide the standard environment and a long-lived switch.

Sourceval init : env:Eio_unix.Stdenv.base -> sw:Eio.Switch.t -> unit
Sourceval env_opt : unit -> Eio_unix.Stdenv.base option
Sourceval switch_opt : unit -> Eio.Switch.t option
Sourceval page_switch_opt : unit -> Eio.Switch.t option
Sourceval require_runtime : unit -> Eio_unix.Stdenv.base * Eio.Switch.t
Sourceval require_env_and_switch : unit -> Eio_unix.Stdenv.base * Eio.Switch.t
Sourceval require_current_switch : unit -> Eio.Switch.t
Sourceval with_page_scope : (unit -> 'a) -> 'a

Run f inside with_page_switch when a runtime is active; otherwise run f directly. Useful for drivers that may be constructed before the runtime is initialized but should still scope fibers when possible.

Sourceval with_page_switch : (Eio_unix.Stdenv.base -> Eio.Switch.t -> 'a) -> 'a

Run f inside a fresh page-scoped switch. All fibers spawned via spawn (or other helpers using require_current_switch) while f executes are attached to that switch and are cancelled when it closes. Nested calls replace the current page switch until they return.

Sourceval with_env : (Eio_unix.Stdenv.base -> 'a) -> 'a
Sourceval spawn : (Eio_unix.Stdenv.base -> unit) -> unit

Spawn a fiber on the current page switch if one is active, otherwise on the long-lived runtime switch.

Sourceval sleep : float -> unit
Sourceval is_shutdown : unit -> bool

Check if shutdown has been requested. Fibers should check this periodically.

Sourceval shutdown : unit -> unit

Signal all fibers to stop. Call this before exiting the application.