pub struct SchedContext {
pub class: SchedClass,
pub priority: Priority,
pub period_us: OptUs,
pub budget_us: OptUs,
pub deadline_us: OptUs,
pub deadline_policy: DeadlinePolicy,
pub os_pri: u8,
pub deadline_action: DeadlineAction,
pub tt_window_offset_us: OptUs,
pub tt_window_duration_us: OptUs,
}Expand description
First-class scheduling capability — one SC per scheduling concern, shared by every callback that should run under the same budget / period / deadline / class.
Phase 110.B.a defines the shape; 110.B.b’s builder methods on Executor consume it.
Fields§
§class: SchedClass§priority: Priority§period_us: OptUs§budget_us: OptUs§deadline_us: OptUs§deadline_policy: DeadlinePolicy§os_pri: u8Phase 110.F — opt-in OS-level priority for per-callback
dispatch. 0 (default) means “no per-callback OS priority”
— the executor’s cooperative dispatch path runs every
callback bound to this SC. Non-zero values trigger the
per-priority worker-pool path (registered via
Executor::register_os_priority_dispatcher); each callback
then runs on a worker thread the OS scheduler has elevated
to that numeric priority.
Numeric meaning is platform-defined (POSIX 1..99 for SCHED_FIFO; FreeRTOS 0..configMAX_PRIORITIES-1; Zephyr direction-flipped). Chain-priority assignment + chain grouping happen at the orchestration layer and are out of executor scope.
deadline_action: DeadlineActionPhase 110.G — time-triggered window offset within the
executor’s major frame. None (sentinel 0) = always
eligible (no TT gate); Some(off) + tt_window_duration_us
gates dispatch to the half-open interval
[off, off + duration) mod major_frame.
Independent of class — a Sporadic-class SC can also be TT-
gated; both gates apply (skip dispatch when EITHER fails).
Pairs with Executor::register_time_triggered_dispatcher
which sets the major-frame length.
W3b.5 — reaction on a deadline miss (see DeadlineAction).
tt_window_offset_us: OptUs§tt_window_duration_us: OptUsPhase 110.G — time-triggered window length. See
tt_window_offset_us.
Implementations§
Source§impl SchedContext
impl SchedContext
pub const fn new_fifo() -> SchedContext
Sourcepub fn from_tier_policy(
class: Option<&str>,
period_us: Option<u64>,
budget_us: Option<u64>,
deadline_us: Option<u64>,
deadline_policy: Option<&str>,
) -> Option<(SchedContext, Option<u32>)>
pub fn from_tier_policy( class: Option<&str>, period_us: Option<u64>, budget_us: Option<u64>, deadline_us: Option<u64>, deadline_policy: Option<&str>, ) -> Option<(SchedContext, Option<u32>)>
RFC-0052 — the common backend that lowers an RTOS-agnostic tier
policy ([tiers.<t>] class / budget / period / deadline) to a
SchedContext. ONE implementation shared by every language: the Rust
runtime ([crate::node_runtime::ExecutorNodeRuntime::apply_tier_sched_policy])
and the C / C++ entries (nros_{c,cpp}_create_sched_context_from_policy)
all call this, so the mapping can never drift between codegen paths.
real_time+budget_us+period_us→SchedClass::Sporadic(budget + RT replenishment period on the SC);best_effort→SchedClass::BestEffort;time_triggered+period_us→ a TT window (major frame =period_us, window =budget_usor the whole frame). The returnedSome(frame_us)is the major frame the caller must install viacrate::executor::Executor::register_time_triggered_dispatcher(the SC itself staysFifo-class per the 110.G TT refactor);deadline_ussets the SC deadline;deadline_policyitsDeadlineAction.
Returns None when the tier declares no class / budget / deadline — the
caller keeps the default Fifo SC (byte-identical pre-policy behavior).
os_pri is intentionally NOT set here (it is an orthogonal per-callback
OS-priority knob the caller applies); this fn covers only the
RTOS-agnostic real-time policy.
Trait Implementations§
Source§impl Clone for SchedContext
impl Clone for SchedContext
Source§fn clone(&self) -> SchedContext
fn clone(&self) -> SchedContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more