Enum r3_core::kernel::raw::MutexProtocol
source · #[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§
source§impl 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§
source§impl Clone for MutexProtocol
impl Clone for MutexProtocol
source§fn clone(&self) -> MutexProtocol
fn clone(&self) -> MutexProtocol
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for MutexProtocol
impl Debug for MutexProtocol
source§impl PartialEq<MutexProtocol> for MutexProtocol
impl PartialEq<MutexProtocol> for MutexProtocol
source§fn eq(&self, other: &MutexProtocol) -> bool
fn eq(&self, other: &MutexProtocol) -> bool
self
and other
values to be equal, and is used
by ==
.