|
oveRTOS C++ API
C++20 RAII wrappers for the oveRTOS C API
|
RAII wrapper around an oveRTOS recursive mutex. More...
#include <sync.hpp>
Public Member Functions | |
| RecursiveMutex () | |
| Constructs and initialises the recursive mutex. | |
| ~RecursiveMutex () noexcept | |
| Destroys the recursive mutex, releasing the underlying kernel resource. | |
| RecursiveMutex (const RecursiveMutex &)=delete | |
| RecursiveMutex & | operator= (const RecursiveMutex &)=delete |
| RecursiveMutex (RecursiveMutex &&other) noexcept | |
| Move constructor — transfers ownership of the kernel handle. | |
| RecursiveMutex & | operator= (RecursiveMutex &&other) noexcept |
| Move-assignment operator — transfers ownership of the kernel handle. | |
| void | lock () |
| Acquires the recursive mutex, blocking indefinitely. | |
| bool | try_lock () |
Non-blocking acquisition attempt. Part of the Lockable named requirement satisfied by this class. | |
| template<class Rep , class Period > | |
| Result< void > | try_lock_for (const std::chrono::duration< Rep, Period > &rel) noexcept |
Bounded-wait acquisition. Same shape as Mutex::try_lock_for — see that method for the TimedLockable non-satisfaction rationale. | |
| template<class Clock , class Duration > | |
| Result< void > | try_lock_until (const std::chrono::time_point< Clock, Duration > &deadline) noexcept |
| Deadline-based acquisition templated over the clock. | |
| void | unlock () |
| Releases one level of the recursive lock. | |
| bool | valid () const |
Returns true if the underlying kernel handle is non-null. | |
| ove_mutex_t | handle () const |
| Returns the raw oveRTOS mutex handle. | |
RAII wrapper around an oveRTOS recursive mutex.
A recursive mutex may be locked multiple times by the same thread without deadlocking; each lock call must be paired with a matching unlock call. Ownership and zero-heap behaviour mirror that of Mutex.
|
inline |
Constructs and initialises the recursive mutex.
Calls ove_recursive_mutex_init (zero-heap) or ove_recursive_mutex_create (heap). Asserts at startup on failure.
|
inlinenoexcept |
Move constructor — transfers ownership of the kernel handle.
| other | The source; its handle is set to null after the move. |
|
inlinenoexcept |
Move-assignment operator — transfers ownership of the kernel handle.
| other | The source; its handle is set to null after the move. |
|
inline |
Acquires the recursive mutex, blocking indefinitely.
Same fatal-on-failure semantics as Mutex::lock.
|
inline |
Non-blocking acquisition attempt. Part of the Lockable named requirement satisfied by this class.
true on acquisition (or recursive re-acquisition), false if the mutex is held by another thread.
|
inlinenoexcept |
Bounded-wait acquisition. Same shape as Mutex::try_lock_for — see that method for the TimedLockable non-satisfaction rationale.
| [in] | rel | Relative timeout (any std::chrono::duration unit). |
Result<void> on acquisition; unexpected Error::Timeout if the deadline elapsed without the lock being acquired; unexpected with another Error value on backend failure.
|
inlinenoexcept |
Deadline-based acquisition templated over the clock.
Same clock-templating rationale as Mutex::try_lock_until (deadline converted to a relative duration internally).
Result<void> with Error::Timeout on timeout.
|
inline |
Returns true if the underlying kernel handle is non-null.
true when the mutex was successfully initialised.
|
inline |
Returns the raw oveRTOS mutex handle.
ove_mutex_t handle.