Ownership-based wrapper for a FreeRTOS-style binary semaphore.
More...
#include <freertos_semaphore.hpp>
Ownership-based wrapper for a FreeRTOS-style binary semaphore.
Typical usage is event signaling between execution contexts (task-to-task or ISR-to-task). Unlike a mutex, binary semaphores do not provide ownership tracking or priority inheritance. Take/give is explicit.
Typical usage:
(void)ready.Give();
if(ready.Take(50)) {
}
Ownership-based wrapper for a FreeRTOS-style binary semaphore.
Definition freertos_semaphore.hpp:35
◆ FreeRtosBinarySemaphore() [1/2]
| c7222::FreeRtosBinarySemaphore::FreeRtosBinarySemaphore |
( |
| ) |
|
|
default |
Construct an uninitialized semaphore wrapper.
◆ FreeRtosBinarySemaphore() [2/2]
| c7222::FreeRtosBinarySemaphore::FreeRtosBinarySemaphore |
( |
bool |
initially_given | ) |
|
|
explicit |
Construct and initialize a binary semaphore.
- Parameters
-
| initially_given | If true, semaphore starts in the available state. |
◆ ~FreeRtosBinarySemaphore()
| c7222::FreeRtosBinarySemaphore::~FreeRtosBinarySemaphore |
( |
| ) |
|
Destroy semaphore resources if initialized.
◆ Give()
| bool c7222::FreeRtosBinarySemaphore::Give |
( |
| ) |
|
Give the semaphore from task context.
- Returns
- true on success.
◆ GiveFromISR()
| bool c7222::FreeRtosBinarySemaphore::GiveFromISR |
( |
| ) |
|
Give the semaphore from ISR context.
- Returns
- true on success.
◆ Initialize()
| bool c7222::FreeRtosBinarySemaphore::Initialize |
( |
bool |
initially_given = false | ) |
|
Initialize (or re-initialize) the semaphore.
- Parameters
-
| initially_given | If true, semaphore starts in the available state. |
- Returns
- true on success.
◆ IsValid()
| bool c7222::FreeRtosBinarySemaphore::IsValid |
( |
| ) |
const |
- Returns
- true if the wrapper owns a valid semaphore handle.
◆ Take()
| bool c7222::FreeRtosBinarySemaphore::Take |
( |
std::uint32_t |
ticks_to_wait = 0 | ) |
|
Take the semaphore.
- Parameters
-
| ticks_to_wait | Max ticks to wait (0 = non-blocking). |
- Returns
- true if acquired.
The documentation for this class was generated from the following file: