pub trait PlatformCriticalSection {
// Required methods
fn acquire() -> u32;
fn release(token: u32);
}Expand description
Global mutual exclusion against preemption + ISR delivery (Phase 121.9).
Backs the Rust critical_section::Impl registration used by
DDS, nros-rmw-{xrce,zenoh}, and any other no_std consumer of
critical_section::with(). The token returned by acquire is
passed back to release; it holds whatever bookkeeping the
platform needs to restore the prior posture (Cortex-M PRIMASK bit,
Cortex-R CPSR I-bit, RISC-V mstatus.MIE snapshot, pthread
recursion depth, etc.) and is opaque to callers.
Reentrant by contract: nested acquire / release pairs must
stack — the platform impl is responsible for nesting (PRIMASK
already stacks; pthread side uses a recursive mutex).
Required Methods§
Sourcefn acquire() -> u32
fn acquire() -> u32
Enter a critical section. Returns an opaque token to pass to
Self::release.
Sourcefn release(token: u32)
fn release(token: u32)
Leave a critical section, restoring the posture captured at
Self::acquire.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.