The TimedMutex is a synchronization primitive that can be used to protect shared data from being simultaneously accessed by multiple threads with timeouts and deadlines, extending the Mutex. It offers exclusive, non-recursive ownership semantics where priority inheritance is used to solve the classic priority-inversion problem. This is thread safe, but NOT IRQ safe.
Public Member Functions | |
| TimedMutex (const TimedMutex &)=delete | |
| TimedMutex (TimedMutex &&)=delete | |
| TimedMutex & | operator= (const TimedMutex &)=delete |
| TimedMutex & | operator= (TimedMutex &&)=delete |
| bool | try_lock_for (chrono::SystemClock::duration timeout) |
| bool | try_lock_until (chrono::SystemClock::time_point deadline) |
Public Member Functions inherited from pw::sync::Mutex | |
| Mutex (const Mutex &)=delete | |
| Mutex (Mutex &&)=delete | |
| Mutex & | operator= (const Mutex &)=delete |
| Mutex & | operator= (Mutex &&)=delete |
| void | lock () |
| bool | try_lock () |
| void | unlock () |
| native_handle_type | native_handle () |
Additional Inherited Members | |
Public Types inherited from pw::sync::Mutex | |
| using | native_handle_type = backend::NativeMutexHandle |
Protected Member Functions inherited from pw::sync::Mutex | |
| backend::NativeMutex & | native_type () |
| const backend::NativeMutex & | native_type () const |
| bool pw::sync::TimedMutex::try_lock_for | ( | chrono::SystemClock::duration | timeout | ) |
Tries to lock the mutex. Blocks until specified the timeout has elapsed or the lock is acquired, whichever comes first. Returns true if the mutex was successfully acquired.
| bool pw::sync::TimedMutex::try_lock_until | ( | chrono::SystemClock::time_point | deadline | ) |
Tries to lock the mutex. Blocks until specified deadline has been reached or the lock is acquired, whichever comes first. Returns true if the mutex was successfully acquired.