FreeRTOScpp
|
#include <MutexCPP.h>
Public Member Functions | |
Mutex (char const *name) | |
Constructor. | |
~Mutex () | |
Destructor. | |
bool | give () override |
bool | take (TickType_t wait=portMAX_DELAY) override |
Private Member Functions | |
Mutex (Mutex const &)=delete | |
We are not copyable. | |
void | operator= (Mutex const &)=delete |
We are not assignable. | |
Private Attributes | |
SemaphoreHandle_t | mutexHandle |
Mutex Wrapper.
A Mutex is a basic synchronization primitive allowing mutual exclusion to be handled which also implements priority inheritance. Note, the basic mutex is NOT recursive, ie if a Task has taken the Mutex, it must not try to take it again before giving it. If you need this, use a RecurviseMutex.
The usage of a Mutex is similar to a semaphore, but the task that takes the Mutex is also supposed to be the Task that eventually gives it back. It also doesn't normally make sense for an ISR to use a Mutex, so no _ISR routines have been made available.
Example Usage:
|
inline |
Constructor.
name | Name to give mutex, used for Debug Registry if setup |
|
inline |
Destructor.
Deletes the semaphore.
|
privatedelete |
We are not copyable.
|
inlineoverridevirtual |
Implements Lockable.
|
privatedelete |
We are not assignable.
|
inlineoverridevirtual |
Implements Lockable.
|
private |