|
| | Semaphore (unsigned int initial=0, unsigned int max=1) |
| | Constructs and initialises the semaphore.
|
| |
|
| ~Semaphore () |
| | Destroys the semaphore, releasing the underlying kernel resource.
|
| |
|
| Semaphore (const Semaphore &)=delete |
| |
|
Semaphore & | operator= (const Semaphore &)=delete |
| |
| | Semaphore (Semaphore &&other) noexcept |
| | Move constructor — transfers ownership of the kernel handle.
|
| |
| Semaphore & | operator= (Semaphore &&other) noexcept |
| | Move-assignment operator — transfers ownership of the kernel handle.
|
| |
| int | take (uint32_t timeout_ms=OVE_WAIT_FOREVER) |
| | Decrements the semaphore count, blocking if the count is zero.
|
| |
| void | give () |
| | Increments the semaphore count, unblocking a waiting task if any.
|
| |
| bool | valid () const |
| | Returns true if the underlying kernel handle is non-null.
|
| |
| ove_sem_t | handle () const |
| | Returns the raw oveRTOS semaphore handle.
|
| |
RAII wrapper around an oveRTOS counting semaphore.
A counting semaphore with a configurable initial count and maximum count. Commonly used as a binary semaphore (initial = 0, max = 1) for signalling between tasks or from an ISR.
With CONFIG_OVE_ZERO_HEAP the semaphore storage is held inline and move operations are disabled.
- Note
- Not copyable. Move-only when heap allocation is enabled.
-
take() is marked [[nodiscard]]; the return value indicates whether the semaphore was actually decremented.