Skuld.Coroutine.ForeignSuspensions (skuld_concurrency v0.32.0)
View SourceAggregate 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 aggregatesuspensions— the list ofForeignSuspendvalues to resolveenv— the computation environmentresume— closure(%{id => value}) -> Coroutine.t()that batch-wakes fibers
Summary
Types
@type t() :: %Skuld.Coroutine.ForeignSuspensions{ env: Skuld.Comp.Env.t(), id: term(), resume: (map() -> t()), suspensions: [Skuld.Comp.ForeignSuspend.t()] }