Skip to main content

Module levels

Module levels 

Source
Expand description

The Rust sched task runners’ level core: one executor per core, a worker per level. The Rust sched task runners’ LEVEL core: one executor per core, a worker per level over it.

The C-ABI runners reach this through nros-cpp’s scheduler FFI (nros_cpp_level_open, nros_cpp_level_spin_once); a Rust runner holds the core’s ExecutorNodeRuntime itself and uses the same three steps:

  1. LevelCore::new – the boot level’s runtime, leaked for the image’s life, with the port’s recursive priority-inheriting mutex and the calling thread’s identity installed as the executor’s lock (nros_node::executor::exec_lock::ExecLock) when more than one level runs, the level count stated, and the boot level made current.

  2. LevelCore::open_level + LevelCore::with_runtime – on a level’s own thread: its worker record (leaked with the level), its waiter linked into the executor’s arrival routing, then the image’s setup run on the shared runtime with the level’s groups active and the level registering, all under the lock.

  3. LevelCore::spin_level_once / LevelCore::spin_boot_once – one pass of a level’s worker (its band, the lock released around each callback, then the ticks of the components its level registered) or of the boot level (the executor’s own worker: transport, executor-wide chores, the boot level’s component ticks). A component ticks on the level that registered it, never on two.

  4. LevelCore::into_runtime: once every other level’s thread has stopped and been joined, the boot level takes the runtime back (the lock removed), so a hosted runner can close its session and return. An RTOS runner never calls it: its levels spin for the image’s life.

Every access goes through the raw runtime pointer with the lock taken first, so no reference to the runtime or its executor is live across another thread’s pass.

Structs§

BandWaiter
A band worker’s wake object and the slots it answers for. The transport’s arrival path reads it without the executor’s lock, so it is 'static and its fields are atomics or fixed at construction; it is linked into the executor’s arrival routing by Executor::attach_band_worker and never unlinked.
LevelCore
The core’s runtime, shared by every level of the image. Copy: each level’s thread carries the handle.
RunToCompletionLevels
Levels that RUN TO COMPLETION: one pass per wake, never a blocking wait.

Enums§

LevelError
Why a level could not be set up.

Type Aliases§

BandWaitFn
How a band worker waits on its own wake object: at most us microseconds, returning early when the object is signalled (WorkerWakeFn). The answer is ignored: either way the worker re-scans.
WorkerWakeFn
How a scheduler signals a worker’s wake object (NodeWake on a real port; a mock kernel in the tests).