|
CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
|
RAII wrapper for a FreeRTOS semaphore / mutex. More...
#include <Raii.h>
Public Member Functions | |
| MutexGuard (SemaphoreHandle_t sem) noexcept | |
Take sem blocking until acquired. | |
| ~MutexGuard () noexcept | |
| MutexGuard (const MutexGuard &)=delete | |
| MutexGuard & | operator= (const MutexGuard &)=delete |
| MutexGuard (MutexGuard &&other) noexcept | |
| bool | locked () const noexcept |
| True if the semaphore is currently held. | |
| void | release () noexcept |
| Release the semaphore before destruction. Idempotent. | |
Static Public Member Functions | |
| static MutexGuard | tryLock (SemaphoreHandle_t sem, TickType_t ticks) noexcept |
RAII wrapper for a FreeRTOS semaphore / mutex.
Default constructor takes the semaphore with portMAX_DELAY; destructor gives it back. Use the static tryLock factory for non-blocking acquisition. Non-copyable.
Not safe to call from ISR context (use xSemaphoreTakeFromISR directly there).
|
inlineexplicitnoexcept |
Take sem blocking until acquired.
Definition at line 184 of file Raii.h.
Referenced by MutexGuard(), MutexGuard(), operator=(), and tryLock().
|
delete |
References MutexGuard().
|
inlinenoexcept |
Definition at line 197 of file Raii.h.
References MutexGuard().
|
inlinenoexcept |
|
delete |
References MutexGuard().
|
inlinenoexcept |
|
inlinestaticnoexcept |
Try to acquire sem for up to ticks ticks. The returned guard is "locked" only if acquisition succeeded; check via .locked().
Definition at line 218 of file Raii.h.
References MutexGuard().