Embedded Artistry Framework
Embedded Systems C++ Framework
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
os::freertos::ConditionVariable Class Referencefinal

#include <freertos_condition_variable.hpp>

Inheritance diagram for os::freertos::ConditionVariable:
Inheritance graph

Public Member Functions

 ConditionVariable ()=default
 
 ~ConditionVariable () noexcept
 
bool wait (embvm::VirtualMutex *mutex) noexcept final
 Blocks the current thread until the condition variable is woken up or after the specified timeout duration. More...
 
bool wait (embvm::VirtualMutex *mutex, const embvm::os_timeout_t &timeout) noexcept final
 
bool wait (embvm::VirtualMutex *mutex, const timespec &timeout) noexcept
 
void signal () noexcept final
 notifies one waiting thread More...
 
void broadcast () noexcept final
 Notify all waiting threads. More...
 
embvm::cv::handle_t native_handle () const noexcept final
 
bool wait (embvm::VirtualMutex *mutex, const embvm::cv::func_t &predicate) noexcept
 
bool wait (embvm::VirtualMutex *mutex, const embvm::cv::func_t &predicate, const embvm::os_timeout_t &timeout=embvm::OS_WAIT_FOREVER) noexcept
 
void notify_one () noexcept
 Alias for signal so we can work with STL types. More...
 
void notify_all () noexcept
 Alias for broadcast so we can work with STL types. More...
 

Private Types

using TQueueType = typename std::conditional<(FREERTOS_NUM_THREADS_PER_CV==0), std::queue< embvm::thread::handle_t >, etl::queue< embvm::thread::handle_t, FREERTOS_NUM_THREADS_PER_CV > >::type
 

Private Member Functions

bool freertos_wait (embvm::VirtualMutex *mutex, uint32_t ticks_timeout) noexcept
 
void pop_and_notify () noexcept
 

Private Attributes

os::freertos::Semaphore sem_ {embvm::semaphore::mode::binary}
 
TQueueType q_
 

Member Typedef Documentation

◆ TQueueType

Constructor & Destructor Documentation

◆ ConditionVariable()

os::freertos::ConditionVariable::ConditionVariable ( )
default

◆ ~ConditionVariable()

ConditionVariable::~ConditionVariable ( )
noexcept

References assert, and q_.

Member Function Documentation

◆ broadcast()

void ConditionVariable::broadcast ( )
finalvirtualnoexcept

◆ freertos_wait()

bool ConditionVariable::freertos_wait ( embvm::VirtualMutex mutex,
uint32_t  ticks_timeout 
)
privatenoexcept

◆ native_handle()

embvm::cv::handle_t os::freertos::ConditionVariable::native_handle ( ) const
inlinefinalvirtualnoexcept

◆ notify_all()

void embvm::VirtualConditionVariable::notify_all ( )
inlinenoexceptinherited

Alias for broadcast so we can work with STL types.

References embvm::VirtualConditionVariable::broadcast().

◆ notify_one()

void embvm::VirtualConditionVariable::notify_one ( )
inlinenoexceptinherited

Alias for signal so we can work with STL types.

References embvm::VirtualConditionVariable::signal().

◆ pop_and_notify()

void ConditionVariable::pop_and_notify ( )
privatenoexcept

References q_.

Referenced by broadcast(), and signal().

◆ signal()

void ConditionVariable::signal ( )
finalvirtualnoexcept

◆ wait() [1/5]

bool ConditionVariable::wait ( embvm::VirtualMutex mutex)
finalvirtualnoexcept

Blocks the current thread until the condition variable is woken up or after the specified timeout duration.

Implements embvm::VirtualConditionVariable.

References portMAX_DELAY.

◆ wait() [2/5]

bool ConditionVariable::wait ( embvm::VirtualMutex mutex,
const embvm::os_timeout_t timeout 
)
finalvirtualnoexcept

◆ wait() [3/5]

bool ConditionVariable::wait ( embvm::VirtualMutex mutex,
const timespec timeout 
)
noexcept

◆ wait() [4/5]

bool embvm::VirtualConditionVariable::wait ( embvm::VirtualMutex mutex,
const embvm::cv::func_t predicate 
)
inlinenoexceptinherited

◆ wait() [5/5]

bool embvm::VirtualConditionVariable::wait ( embvm::VirtualMutex mutex,
const embvm::cv::func_t predicate,
const embvm::os_timeout_t timeout = embvm::OS_WAIT_FOREVER 
)
inlinenoexceptinherited

We break when the predicate is true or when we've timed out

References embvm::VirtualConditionVariable::wait().

Member Data Documentation

◆ q_

TQueueType os::freertos::ConditionVariable::q_
private

◆ sem_

os::freertos::Semaphore os::freertos::ConditionVariable::sem_ {embvm::semaphore::mode::binary}
private

Referenced by broadcast(), native_handle(), and signal().


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