FreeRTOS C++ Wrappers  1.6.0
C++ interface to FreeRTOS
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
cpp_freertos::ConditionVariable Class Reference

#include <condition_variable.hpp>

Collaboration diagram for cpp_freertos::ConditionVariable:
Collaboration graph
[legend]

Public Member Functions

 ConditionVariable ()
 
void Signal ()
 
void Broadcast ()
 

Private Member Functions

void AddToWaitList (Thread *thread)
 

Private Attributes

MutexStandard Lock
 
std::list< Thread * > WaitList
 

Friends

class Thread
 

Detailed Description

Class implementation of condition variable based on FreeRTOS C++ Wrapper classes.

A condition variable isn't really a variable. It's a list of threads.

The design here is that a Thread "waits", and a ConditionVariable "signals". This affects where the public interfaces reside.

Definition at line 74 of file condition_variable.hpp.

Constructor & Destructor Documentation

◆ ConditionVariable()

ConditionVariable::ConditionVariable ( )

Constructor to create a condition variable.

Definition at line 52 of file ccondition_variable.cpp.

Member Function Documentation

◆ AddToWaitList()

void ConditionVariable::AddToWaitList ( Thread thread)
private

Internal helper function to queue a Thread to this ConditionVariable's wait list.

Definition at line 58 of file ccondition_variable.cpp.

◆ Broadcast()

void ConditionVariable::Broadcast ( )

Signal all threads waiting on this ConditionVariable.

Definition at line 98 of file ccondition_variable.cpp.

◆ Signal()

void ConditionVariable::Signal ( )

Signal a thread waiting on this ConditionVariable. Signaling is implemented as FIFO.

Definition at line 77 of file ccondition_variable.cpp.

Friends And Related Function Documentation

◆ Thread

friend class Thread
friend

The Thread class and the ConditionVariable class are interdependent. If we allow the Thread class to access the internals of the ConditionVariable, we can reduce the public interface which is a good thing.

Definition at line 130 of file condition_variable.hpp.

Member Data Documentation

◆ Lock

MutexStandard cpp_freertos::ConditionVariable::Lock
private

Protect the internal ConditionVariable state.

Definition at line 111 of file condition_variable.hpp.

◆ WaitList

std::list<Thread *> cpp_freertos::ConditionVariable::WaitList
private

Implementation of a wait list of Threads.

Definition at line 116 of file condition_variable.hpp.


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