pub enum RtPolicy {
Disabled,
AllowRealtime,
}Expand description
Whether this process may ask the OS for real-time scheduling.
Resolved from RT_PRIORITY_ENV exactly once per process by
RtPolicy::current. It is a parameter of
apply_to_current_thread_under rather than a check buried inside the
syscall wrapper, so “switch off ⟹ no scheduler call” is a property of
the call graph and not of a runtime branch some future caller can skip.
Variants§
Disabled
Never touch the OS scheduler.
AllowRealtime
Best-effort SCHED_FIFO, falling back to default scheduling.
Implementations§
Source§impl RtPolicy
impl RtPolicy
Sourcepub fn from_env_value(raw: Option<&str>) -> RtPolicy
pub fn from_env_value(raw: Option<&str>) -> RtPolicy
Parse a raw switch value (None = unset ⇒ DEFAULT_POLICY).
Sourcepub fn resolve(raw: Option<&str>, default: RtPolicy) -> RtPolicy
pub fn resolve(raw: Option<&str>, default: RtPolicy) -> RtPolicy
Self::from_env_value with the unset-default injected, so a host
test can ask what an RTEMS process would do with the same input.
Sourcepub fn current() -> RtPolicy
pub fn current() -> RtPolicy
The process-wide policy, read from RT_PRIORITY_ENV on first use
and cached. Caching matches C, which resolves its switch once in
epicsThreadInit (osdThread.c:389), and keeps later set_var
calls from changing the scheduling of threads already running.