#[non_exhaustive]
pub enum MutexProtocol {
None,
Ceiling(usize),
}
Expand description
Specifies the locking protocol to be followed by a mutex.
This enum
type is defined as #[non_exhaustive]
to allow for potential
future extensions.
The function MutexProtocol::is_supported
indicates whether a
MutexProtocol
is supported by the kernel. The behavior is
implementation-defined (preferably approximating the request or falling back
to a supported option) if a specified MutexProtocol
is not supported.
Relation to Other Specifications: The operating systems and operating system specifications providing an interface for specifying a mutex protocol include (but are not limited to) the following: POSIX (
pthread_mutexattr_setprotocol
andPTHREAD_PRIO_PROTECT
, etc.), RTEMS Classic API (RTEMS_PRIORITY_CEILING
, etc.), and μITRON4.0 (TA_CEILING
, etc.).
Rationale: When this enumerate type was added, the plan was to only support the priority ceiling protocol, so having a method
CfgMutexBuilder::ceiling_priority
taking a priority ceiling value would have been simpler. Nevertheless, it was decided to use this enumerate type to accomodate other protocols in the future and to allow specifying protocol-specific parameters.
Variants (Non-exhaustive)
This enum is marked as non-exhaustive
None
Locking the mutex does not affect the priority of the owning task.
Ceiling(usize)
Locking the mutex raises the effective priority of the owning task to the mutex’s priority ceiling according to the immediate priority ceiling protocol. The inner value specifies the priority ceiling.
The value must be in range 0..
num_task_priority_levels
.
Implementations
sourceimpl MutexProtocol
impl MutexProtocol
sourcepub const fn is_supported<System: KernelMutex>(&self) -> bool
pub const fn is_supported<System: KernelMutex>(&self) -> bool
Return a flag indicating whether the kernel supports this MutexProtocol
.
It’s possible for this function to return false
for all possible
values of MutexProtocol
if the kernel doesn’t precisely implement any
possible options of MutexProtocol
.
Trait Implementations
sourceimpl Clone for MutexProtocol
impl Clone for MutexProtocol
sourcefn clone(&self) -> MutexProtocol
fn clone(&self) -> MutexProtocol
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for MutexProtocol
impl Debug for MutexProtocol
sourceimpl PartialEq<MutexProtocol> for MutexProtocol
impl PartialEq<MutexProtocol> for MutexProtocol
sourcefn eq(&self, other: &MutexProtocol) -> bool
fn eq(&self, other: &MutexProtocol) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &MutexProtocol) -> bool
fn ne(&self, other: &MutexProtocol) -> bool
This method tests for !=
.
impl Copy for MutexProtocol
impl Eq for MutexProtocol
impl StructuralEq for MutexProtocol
impl StructuralPartialEq for MutexProtocol
Auto Trait Implementations
impl RefUnwindSafe for MutexProtocol
impl Send for MutexProtocol
impl Sync for MutexProtocol
impl Unpin for MutexProtocol
impl UnwindSafe for MutexProtocol
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more