pub struct SpawnerSlot { /* private fields */ }Expand description
A runtime-filled slot holding the SendSpawner of an executor other than
the one the supervisor runs on — an InterruptExecutor tier, the second
core’s executor, any foreign thread executor (via Spawner::make_send()).
Declared by the executor NAME; item of supervisor_graph!; nodes carrying
executor: NAME are spawned through the slot instead of the supervisor’s own
Spawner. The application fills it once at startup — before, or concurrently
with, Supervisor::start (e.g. from the second core’s bring-up):
static EXECUTOR_HIGH: InterruptExecutor = InterruptExecutor::new();
HIGH.set(EXECUTOR_HIGH.start(interrupt::SWI_IRQ_0));
sup.start(spawner).await?; // nodes declared `executor: HIGH` spawn on that tierThe supervisor’s bring-up (start / start_node / respawn_terminate) awaits
ready for a node’s slot before spawning it, so a tier filled
late — or from another core — is handled without a race; a slot still empty after
the supervisor’s bounded wait fails the spawn with SpawnError::Busy rather
than silently dropping the task. Spawned futures must be Send (a non-Send
executor: task is a compile error at the glue).
Implementations§
Source§impl SpawnerSlot
impl SpawnerSlot
Sourcepub fn set(&self, spawner: SendSpawner)
pub fn set(&self, spawner: SendSpawner)
Fill the slot (last set wins) and wake a ready waiter.
Call before Supervisor::start — or from the other core’s bring-up,
with the supervisor awaiting ready().
Sourcepub fn get(&self) -> Option<SendSpawner>
pub fn get(&self) -> Option<SendSpawner>
The registered spawner, or None while unfilled.
Sourcepub async fn ready(&self) -> SendSpawner
pub async fn ready(&self) -> SendSpawner
Await the slot and return the spawner. The rendezvous primitive: the
supervisor’s bring-up awaits this for a node’s executor: slot before
spawning it (bounded, see Supervisor::start), so a tier filled late — or
from another core — is handled without a race. Returns immediately once the
slot is filled, so any number of late callers are fine (an application can
gate work on the executor being up). While the slot is still empty, at most
one task should be parked here: the underlying Signal holds a single waker,
so a second pre-fill waiter would displace the first.