Skip to main content

PlatformCriticalSection

Trait PlatformCriticalSection 

Source
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§

Source

fn acquire() -> u32

Enter a critical section. Returns an opaque token to pass to Self::release.

Source

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.

Implementations on Foreign Types§

Source§

impl PlatformCriticalSection for CffiPlatform

Implementors§