package eio

  1. Overview
  2. Docs
type 'a enqueue = ('a, exn) Stdlib.result -> unit

A function provided by the scheduler to reschedule a previously-suspended thread.

type Stdlib.Effect.t +=
  1. | Suspend : (Fiber_context.t -> 'a enqueue -> unit) -> 'a Stdlib.Effect.t
    (*

    Suspend fn is performed when a fiber must be suspended (e.g. because it called Promise.await on an unresolved promise). The effect handler runs fn fiber enqueue in the scheduler context, passing it the suspended fiber's context and a function to resume it. fn should arrange for enqueue to be called once the thread is ready to run again.

    *)
  2. | Fork : Fiber_context.t * (unit -> unit) -> unit Stdlib.Effect.t
    (*

    perform (Fork new_context f) creates a new fiber and runs f in it, with context new_context. f must not raise an exception. See Fiber.fork.

    *)
  3. | Get_context : Fiber_context.t Stdlib.Effect.t
    (*

    perform Get_context immediately returns the current fiber's context (without switching fibers).

    *)
OCaml

Innovation. Community. Security.