Skip to main content

Suspend

Enum Suspend 

Source
pub enum Suspend {
    Delay(u64),
    WaitEvents(EventWaitSet),
    ForkJoin(JoinKind, Vec<SpawnSpec>),
    WaitFork,
    WaitOrder(Vec<ProcessId>),
    WaitForGvt,
    ByRequest,
    Done,
}
Expand description

What a CompiledProcess::resume() call returns to the in-process scheduler orchestration loop. See crate::process::WaitSpec for the lower-level, codegen/ABI-facing sibling of this type and the reconciliation note there.

Fork/join (RESOLVED, docs/CONTRACTS.md “Resolved design decisions” D1). A fork hands the scheduler spawn descriptors, not process identities and not process objects. The three design docs disagreed three ways (scheduler.md: Vec<Box<dyn CompiledProcess>>; the r2 placeholder: Vec<ProcessId>; process.md §7: an undefined ProcessHandle):

  • Vec<ProcessId> is wrong: the children do not exist yet when the parent suspends, so nothing could have assigned those ids.
  • Box<dyn CompiledProcess> contradicts ARCHITECTURE §5’s frozen ABI (a process is an extern "C" ProcessFn entry in VJ_PROCESS_TABLE, not a Rust trait object) and cannot satisfy Suspend: Clone.

Fork branches are statically known code: codegen emits each branch as its own process-table kernel. So the parent returns one SpawnSpec per branch; the scheduler registers each, assigns the child its ProcessId, records the ids in the parent’s ForkFrame::children, sets ForkFrame::remaining per JoinKind (All = n, Any = 1, None = 0 — the parent resumes immediately), and later reports each completion back via ResumeArg::ForkChildDone { child }. Children reach variables declared in the parent’s enclosing scopes through SpawnSpec::parent (LRM 9.3.2). Rolling back a parent that has already spawned live children must also roll back / kill those children — owned by the determinism rows, not this type.

Variants§

§

Delay(u64)

§

WaitEvents(EventWaitSet)

§

ForkJoin(JoinKind, Vec<SpawnSpec>)

§

WaitFork

NEW (Task 9, B-sched wave, ledger SC-125) — scheduler-side half of wait fork;. Blocks the calling process until every ProcessId currently live in its own ProcessDescriptor::fork_children (populated by an earlier fork ... join_none) has reached Suspend::Done and been reclaimed; resumes via ResumeArg::AllForkChildrenDone. See sched::control::Engine:: apply_wait_fork and sched::resume::ResumeDriver::on_child_done’s own doc comments for the mechanism. disable fork; is deliberately not a Suspend variant here – it never suspends the caller, so it is instead a synchronous SchedulerOps::disable_fork call (see that method’s own doc comment).

§

WaitOrder(Vec<ProcessId>)

NEW (Task 9, SC-125) — scheduler-side half of wait_order(a, b, c);. Blocks the calling process until every ProcessId in order has completed, in exactly that declared order; resumes via ResumeArg::WaitOrderSatisfied on success. An out-of-order completion never silently satisfies the wait or panics – it is surfaced as sched::resume::ResumeError::WaitOrderViolated (see that type’s own doc comment).

§

WaitForGvt

Task 8 (AB-085): a barrier-wait suspend – the process yields until every parallel lane has reached the same GVT boundary. Deliberately carries no payload and needs no new coroutine/stack mechanism: it reuses the exact same suspend/resume dispatch every other Suspend variant goes through (apply_suspend in sched::control handles it by delegating to the Delay(0) arm’s existing code path – see that function’s own doc comment). The real GVT-barrier semantics (actually gating resumption on every parallel lane’s progress, not just resolving at the next delta step) belong to the determinism/parallel- engine track and are not implemented by this wave; this variant only wires the ABI-level suspend reason into the existing dispatch so a compiled process can report it.

§

ByRequest

Classes plan Task 13 (LRM 9.7): the process yields because it just queued a ProcessRequest through SchedulerOps::process_request (p.await() / p.suspend() called as a statement). Unlike every other variant it carries no wake condition of its own: the engine resumes the process immediately unless the request left it self-suspended or awaiting another process (see sched::control::Engine::apply_by_request).

§

Done

Trait Implementations§

Source§

impl Clone for Suspend

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Suspend

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V