Skip to main content

RtMutex

Struct RtMutex 

Source
pub struct RtMutex<T> { /* private fields */ }
Available on crate feature std only.
Expand description

A blocking mutex with priority inheritance (RT-CORBA §5.6).

The lock is granted in priority order: when the owner releases, it goes to the highest-priority waiting thread (not FIFO). The effective owner priority (base raised to the highest waiter) is queryable via effective_holder_priority — a runtime integration can use it to track the OS priority of the owner thread.

Implementations§

Source§

impl<T> RtMutex<T>

Source

pub fn new(value: T) -> Self

New, unlocked RtMutex around value.

Source

pub fn lock(&self, my_priority: Priority) -> RtMutexGuard<'_, T>

Locks the mutex for a caller with priority my_priority. Blocks in priority order (Condvar, no spin) until it is its turn.

§Panics

On a poisoned internal lock.

Source

pub fn try_lock(&self, my_priority: Priority) -> Option<RtMutexGuard<'_, T>>

Attempts to lock without blocking. None if already locked.

§Panics

On a poisoned internal lock.

Source

pub fn effective_holder_priority(&self) -> Option<Priority>

Effective priority of the current owner: its base, raised to the highest waiting priority (priority inheritance). None if nobody currently holds the lock.

§Panics

On a poisoned internal lock.

Trait Implementations§

Source§

impl<T: Debug> Debug for RtMutex<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> !Freeze for RtMutex<T>

§

impl<T> RefUnwindSafe for RtMutex<T>

§

impl<T> Send for RtMutex<T>
where T: Send,

§

impl<T> Sync for RtMutex<T>
where T: Send,

§

impl<T> Unpin for RtMutex<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for RtMutex<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for RtMutex<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.