12#ifndef CMSIS_PLUS_RTOS_OS_MUTEX_H_
13#define CMSIS_PLUS_RTOS_OS_MUTEX_H_
17#if defined(__cplusplus)
25#pragma GCC diagnostic push
27#pragma clang diagnostic ignored "-Wc++98-compat"
28#pragma clang diagnostic ignored "-Wdocumentation-unknown-command"
39#pragma GCC diagnostic push
41#pragma clang diagnostic ignored "-Wpadded"
42#elif defined(__GNUC__)
43#pragma GCC diagnostic ignored "-Wpadded"
369 operator= (
const mutex&)
609 internal_init_ (
void);
617 internal_try_lock_ (
thread* th);
625 internal_unlock_ (
thread* th);
628 internal_mark_owner_dead_ (
void);
649 thread*
volatile owner_ =
nullptr;
651#if !defined(OS_USE_RTOS_PORT_MUTEX)
653 clock* clock_ =
nullptr;
662#if defined(OS_USE_RTOS_PORT_MUTEX)
663 friend class port::mutex;
664 os_mutex_port_data_t port_;
676 bool owner_dead_ =
false;
677 bool consistent_ =
true;
678 bool recoverable_ =
true;
766#pragma GCC diagnostic pop
861 :
mutex{ name, attr }
882#pragma GCC diagnostic pop
Base class for attributes.
Base class for named system objects.
const char * name(void) const
Get object name.
Priority ordered list of threads.
Recursive mutex attributes.
attributes_recursive & operator=(const attributes_recursive &)=default
attributes_recursive(const attributes_recursive &)=default
attributes_recursive(attributes_recursive &&)=default
~attributes_recursive()=default
Destruct the recursive mutex attributes object instance.
constexpr attributes_recursive()
Construct a recursive mutex attributes object instance.
count_t mx_max_count
Attribute with the mutex maximum recursive count.
constexpr attributes()
Construct a mutex attributes object instance.
type_t mx_type
Attribute with the mutex type.
robustness_t mx_robustness
Attribute with the mutex robustness.
~attributes()=default
Destruct the mutex attributes object instance.
thread::priority_t mx_priority_ceiling
Attribute with the mutex priority ceiling.
attributes & operator=(const attributes &)=default
protocol_t mx_protocol
Attribute with the mutex protocol.
attributes(attributes &&)=default
attributes(const attributes &)=default
POSIX compliant recursive mutex.
mutex_recursive(const attributes &attr=initializer_recursive)
Construct a recursive mutex object instance.
bool operator==(const mutex_recursive &rhs) const
Compare mutexes.
~mutex_recursive()
Destruct the recursive mutex object instance.
result_t reset(void)
Reset the mutex.
result_t lock(void)
Lock/acquire the mutex.
thread::priority_t prio_ceiling(void) const
Get the priority ceiling of a mutex.
result_t timed_lock(clock::duration_t timeout)
Timed attempt to lock/acquire the mutex.
result_t try_lock(void)
Try to lock/acquire the mutex.
bool operator==(const mutex &rhs) const
Compare mutexes.
~mutex()
Destruct the mutex object instance.
result_t consistent(void)
Mark mutex as consistent.
thread * owner(void)
Get the thread that owns the mutex.
result_t unlock(void)
Unlock/release the mutex.
POSIX compliant thread, using the default RTOS allocator.
The core of a double linked list, pointers to next, previous.
port::clock::duration_t duration_t
Type of variables holding clock durations.
uint8_t type_t
Type of variables holding mutex behaviours.
uint16_t count_t
Type of variables holding mutex recursion counters.
static const attributes_recursive initializer_recursive
Default recursive mutex initialiser.
uint8_t protocol_t
Type of variables holding mutex protocols.
uint8_t robustness_t
Type of variables holding mutex robustness.
static constexpr count_t max_count
Constant with the maximum value for the recursion counter.
static const attributes initializer_normal
Default normal mutex initialiser.
uint8_t priority_t
Type of variables holding thread priorities.
uint32_t result_t
Type of values returned by RTOS functions.
@ max_
Maximum value, for validation purposes.
@ default_
Default value. Differs from POSIX, which uses none.
@ none
Priority and scheduling not affected by mutex ownership.
@ inherit
Inherit priority from highest priority thread.
@ protect
Execute at the highest priority.
@ max_
Maximum value, for validation purposes.
@ stalled
Normal robustness.
@ robust
Enhanced robustness at thread termination.
@ max_
Maximum value, for validation purposes.
@ normal
Normal mutex behaviour.
@ errorcheck
Check mutex behaviour.
@ recursive
Recursive mutex behaviour.