pub struct PriorityMutex<T> { /* private fields */ }Expand description
A mutex that applies priority inheritance to its holder while higher-priority tasks are waiting on it.
#[repr(C)]: the fault-isolation path (poison_mutex) casts a
type-erased pointer to PriorityMutex<()>, so the leading-field layout
must be identical across monomorphizations.
Implementations§
Source§impl<T> PriorityMutex<T>
impl<T> PriorityMutex<T>
pub const fn new(value: T) -> Self
Sourcepub fn is_poisoned(&self) -> bool
pub fn is_poisoned(&self) -> bool
Whether this mutex has been poisoned by a faulting holder.
Sourcepub fn try_lock(&self) -> Option<PriorityMutexGuard<'_, T>>
pub fn try_lock(&self) -> Option<PriorityMutexGuard<'_, T>>
Non-blocking acquire. Returns None if the mutex is held (by
anyone, including this task).
Sourcepub fn lock(&self) -> PriorityMutexGuard<'_, T>
pub fn lock(&self) -> PriorityMutexGuard<'_, T>
Acquire the mutex, blocking (yielding the CPU to other preemptive tasks — not busy-spinning) while it’s held elsewhere. Applies priority inheritance to the current holder for as long as this task waits.
§Panics
Panics if called outside of a preemptive task context, if the
calling task already holds this mutex (recursive lock), or if the
task already holds tcb::MAX_HELD mutexes.
Sourcepub fn lock_timeout(
&self,
timeout: Option<Duration>,
) -> Result<PriorityMutexGuard<'_, T>, LockError>
pub fn lock_timeout( &self, timeout: Option<Duration>, ) -> Result<PriorityMutexGuard<'_, T>, LockError>
Acquire the mutex with a deadline. Returns
LockError::Timeout if the mutex is not acquired within
timeout; None waits forever.