Production-grade wrapper around FreeRTOS Semaphore to mimic std::condition_variable.
More...
#include <FreeRTOSConditionVariable.h>
Production-grade wrapper around FreeRTOS Semaphore to mimic std::condition_variable.
- Uses a Binary Semaphore (1 token).
- ISR-safe notification logic.
- Robust tick overflow handling using elapsed time subtraction.
- Note
- Limitation: Unlike std::cv, a binary semaphore retains its signal state. If notify() occurs before wait(), the wait will effectively "fall through". Multiple notifies before a wait are coalesced into a single signal.
◆ FreeRTOSConditionVariable() [1/2]
| dmq::FreeRTOSConditionVariable::FreeRTOSConditionVariable |
( |
| ) |
|
|
inline |
◆ ~FreeRTOSConditionVariable()
| dmq::FreeRTOSConditionVariable::~FreeRTOSConditionVariable |
( |
| ) |
|
|
inline |
◆ FreeRTOSConditionVariable() [2/2]
◆ notify_one()
| void dmq::FreeRTOSConditionVariable::notify_one |
( |
| ) |
|
|
inlinenoexcept |
Wake up one waiting thread (ISR Safe)
◆ operator=()
◆ wait()
template<typename Lock , typename Predicate >
| void dmq::FreeRTOSConditionVariable::wait |
( |
Lock & | lock, |
|
|
Predicate | pred ) |
|
inline |
Wait indefinitely until predicate is true.
◆ wait_for()
template<typename Lock , typename Predicate >
| bool dmq::FreeRTOSConditionVariable::wait_for |
( |
Lock & | lock, |
|
|
std::chrono::milliseconds | timeout, |
|
|
Predicate | pred ) |
|
inline |
Wait until predicate is true or timeout expires.
Uses overflow-safe subtraction logic to track elapsed ticks.
The documentation for this class was generated from the following file: