Skip to main content

SchedTaskSetupGate

Struct SchedTaskSetupGate 

Source
pub struct SchedTaskSetupGate { /* private fields */ }
Expand description

The spawned sched tasks’ executor backing. nros::main! emits one SchedTaskExecutorBacking static per sched-task entry and hands its slots to the board’s run_sched_tasks, which refuses a short block through check_sched_task_executor_backing and opens each spawned sched task with Executor::open_with_session_slot. Gated like the module it names (has_rmw + alloc in nros-node). The ONE gate a tier runner holds across each tier’s open-and-setup so no two sched tasks declare entities on the shared session at once.

Every sched task executor borrows the boot executor’s ONE RMW session, and a sched task’s setup declares its nodes and entities on it. The backend’s entity-creation path is not reentrant across threads: zenoh’s ZenohSession::create_* takes &mut self and mutates the per-node liveliness table, and the topic-binding scramble that concurrent declares cause was measured. The RTOS runners serialize by CHAINING the spawns (sched task N+1 starts only after sched task N’s setup returned); a runner that spawns every sched task at once holds this instead. Setup runs once per boot and off the hot path, so a sleeping spin costs nothing that matters, and the spin loops that follow stay fully concurrent.

no_std and allocation-free (one atomic flag), so the same gate serves the native C++ runner (nros-cpp), the Linux Rust runner and the NuttX Rust runner. The backoff sleeps through the platform ABI, never spins hot: a waiter that outranks the holder under SCHED_FIFO would otherwise starve it on one CPU.

Implementations§

Source§

impl SchedTaskSetupGate

Source

pub const fn new() -> SchedTaskSetupGate

An open gate.

Source

pub fn enter(&self) -> SchedTaskSetupGuard<'_>

Block until this caller holds the gate; it is released when the returned guard drops (on every return path, including a failed setup).

Trait Implementations§

Source§

impl Debug for SchedTaskSetupGate

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for SchedTaskSetupGate

Source§

fn default() -> SchedTaskSetupGate

Returns the “default value” for a type. 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<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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.