DelegateMQ
Loading...
Searching...
No Matches
dmq::ThreadXConditionVariable Class Reference

Production-grade wrapper around ThreadX Semaphore to mimic std::condition_variable. More...

#include <ThreadXConditionVariable.h>

Public Member Functions

 ThreadXConditionVariable ()
 
 ~ThreadXConditionVariable ()
 
 ThreadXConditionVariable (const ThreadXConditionVariable &)=delete
 
ThreadXConditionVariableoperator= (const ThreadXConditionVariable &)=delete
 
void notify_one () noexcept
 Wake up one waiting thread (ISR Safe)
 
template<typename Lock , typename Predicate >
void wait (Lock &lock, Predicate pred)
 Wait indefinitely until predicate is true.
 
template<typename Lock , typename Predicate >
bool wait_for (Lock &lock, std::chrono::milliseconds timeout, Predicate pred)
 Wait until predicate is true or timeout expires.
 

Detailed Description

Production-grade wrapper around ThreadX Semaphore to mimic std::condition_variable.

  • Uses a Counting Semaphore (initialized to 0).
  • ISR-safe notification logic (tx_semaphore_put).
  • Robust tick overflow handling using elapsed time subtraction.
Note
Limitation: Unlike std::cv, a semaphore retains its signal state. If notify() occurs before wait(), the wait will effectively "fall through".

Constructor & Destructor Documentation

◆ ThreadXConditionVariable() [1/2]

dmq::ThreadXConditionVariable::ThreadXConditionVariable ( )
inline

◆ ~ThreadXConditionVariable()

dmq::ThreadXConditionVariable::~ThreadXConditionVariable ( )
inline

◆ ThreadXConditionVariable() [2/2]

dmq::ThreadXConditionVariable::ThreadXConditionVariable ( const ThreadXConditionVariable & )
delete

Member Function Documentation

◆ notify_one()

void dmq::ThreadXConditionVariable::notify_one ( )
inlinenoexcept

Wake up one waiting thread (ISR Safe)

◆ operator=()

ThreadXConditionVariable & dmq::ThreadXConditionVariable::operator= ( const ThreadXConditionVariable & )
delete

◆ wait()

template<typename Lock , typename Predicate >
void dmq::ThreadXConditionVariable::wait ( Lock & lock,
Predicate pred )
inline

Wait indefinitely until predicate is true.

◆ wait_for()

template<typename Lock , typename Predicate >
bool dmq::ThreadXConditionVariable::wait_for ( Lock & lock,
std::chrono::milliseconds timeout,
Predicate pred )
inline

Wait until predicate is true or timeout expires.


The documentation for this class was generated from the following file: