Skuld.Coroutine.ForeignSuspensions (skuld_concurrency v0.32.0)

View Source

Aggregate of all pending foreign suspensions, returned to the caller (e.g., the Hologram JS runtime) when the FiberPool scheduler exhausts internal work.

The caller extracts the individual ForeignSuspend values from the :suspensions list, resolves them via the foreign platform's event loop, and resumes the computation by calling Coroutine.call/2 with a map of %{suspend_id => resolved_value}.

The :resume field is a closure created by the FiberPool scheduler that captures the FiberPoolState and scheduler loop. It takes the resolved map, wakes all resolved fibers at once by enqueuing them on the run queue, and returns the next Coroutine state.

Fields

  • id — identifier for this aggregate
  • suspensions — the list of ForeignSuspend values to resolve
  • env — the computation environment
  • resume — closure (%{id => value}) -> Coroutine.t() that batch-wakes fibers

Summary

Types

t()

@type t() :: %Skuld.Coroutine.ForeignSuspensions{
  env: Skuld.Comp.Env.t(),
  id: term(),
  resume: (map() -> t()),
  suspensions: [Skuld.Comp.ForeignSuspend.t()]
}