56 handle = xSemaphoreCreateMutex();
57 #if configQUEUE_REGISTRY_SIZE > 0
58 vQueueAddToRegistry(handle, name);
67 vSemaphoreDelete(handle);
70 bool take(TickType_t wait = portMAX_DELAY) {
71 return xSemaphoreTake(handle, wait);
75 return xSemaphoreGive(handle);
78 SemaphoreHandle_t handle;
79 #if __cplusplus < 201101L
81 void operator =(
Mutex const&);
84 void operator =(
Mutex const&) =
delete;
89 #if configUSE_RECURSIVE_MUTEXES > 0
96 class RecursiveMutex {
98 RecursiveMutex(
char const* name) {
99 handle = xSemaphoreCreateRecursiveMutex();
100 #if configQUEUE_REGISTRY_SIZE > 0
101 vQueueAddToRegistry(handle, name);
105 vSemaphoreDelete(handle);
108 bool take(TickType_t wait = portMAX_DELAY) {
109 return xSemaphoreTakeRecursive(handle, wait);
114 return xSemaphoreGiveRecursive(handle);
118 SemaphoreHandle_t handle;
119 #if __cplusplus < 201101L
120 RecursiveMutex(RecursiveMutex
const&);
121 void operator =(RecursiveMutex
const&);
123 RecursiveMutex(RecursiveMutex
const&) =
delete;
124 void operator =(RecursiveMutex
const&) =
delete;
125 #endif // __cplusplus
127 #endif // configUSE_RECURSIVE_MUTEXES
bool take(TickType_t wait=portMAX_DELAY)
Definition: MutexCPP.h:70
~Mutex()
Destructor.
Definition: MutexCPP.h:66
bool give()
Definition: MutexCPP.h:74
Mutex Wrapper.
Definition: MutexCPP.h:49
Mutex(char const *name)
Constructor.
Definition: MutexCPP.h:55