F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
Os::ConditionVariable Class Referencefinal

condition variable implementation More...

#include <Os/Condition.hpp>

Inheritance diagram for Os::ConditionVariable:
Os::ConditionVariableInterface

Public Member Functions

 ConditionVariable ()
 default constructor More...
 
 ~ConditionVariable () final
 default virtual destructor More...
 
 ConditionVariable (const ConditionVariableInterface &other)=delete
 copy constructor is forbidden More...
 
 ConditionVariable (const ConditionVariableInterface *other)=delete
 copy constructor is forbidden More...
 
ConditionVariableInterfaceoperator= (const ConditionVariableInterface &other) override=delete
 assignment operator is forbidden More...
 
void wait (Os::Mutex &mutex) override
 wait on a condition variable More...
 
void notify () override
 notify a single waiter on this condition variable More...
 
void notifyAll () override
 notify all waiters on this condition variable More...
 
ConditionVariableHandlegetHandle () override
 return the underlying condition variable handle (implementation specific). Delegates to implementation. More...
 
- Public Member Functions inherited from Os::ConditionVariableInterface
 ConditionVariableInterface ()=default
 Default constructor. More...
 
virtual ~ConditionVariableInterface ()=default
 Default destructor. More...
 
 ConditionVariableInterface (const ConditionVariableInterface &other)=delete
 copy constructor is forbidden More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Os::ConditionVariableInterface
static ConditionVariableInterfacegetDelegate (ConditionVariableHandleStorage &aligned_new_memory)
 provide a pointer to a Mutex delegate object More...
 

Detailed Description

condition variable implementation

Condition variables allow a program to block on a condition while atomically releasing an Os::Mutex and atomically reacquiring the mutex once the condition has been notified.

Definition at line 66 of file Condition.hpp.

Constructor & Destructor Documentation

◆ ConditionVariable() [1/3]

Os::ConditionVariable::ConditionVariable ( )

default constructor

Definition at line 5 of file Condition.cpp.

◆ ~ConditionVariable()

Os::ConditionVariable::~ConditionVariable ( )
final

default virtual destructor

Definition at line 7 of file Condition.cpp.

◆ ConditionVariable() [2/3]

Os::ConditionVariable::ConditionVariable ( const ConditionVariableInterface other)
delete

copy constructor is forbidden

◆ ConditionVariable() [3/3]

Os::ConditionVariable::ConditionVariable ( const ConditionVariableInterface other)
delete

copy constructor is forbidden

Member Function Documentation

◆ getHandle()

ConditionVariableHandle * Os::ConditionVariable::getHandle ( )
overridevirtual

return the underlying condition variable handle (implementation specific). Delegates to implementation.

Returns
internal task handle representation

Implements Os::ConditionVariableInterface.

Definition at line 29 of file Condition.cpp.

◆ notify()

void Os::ConditionVariable::notify ( )
overridevirtual

notify a single waiter on this condition variable

Notify a single waiter on this condition variable. It is not necessary to hold the mutex supplied by the waiters and it is advantageous not to hold the lock to prevent immediate re-blocking. This function delegates to the underlying implementation.

Implements Os::ConditionVariableInterface.

Definition at line 20 of file Condition.cpp.

◆ notifyAll()

void Os::ConditionVariable::notifyAll ( )
overridevirtual

notify all waiters on this condition variable

Notify all waiters on this condition variable. It is not necessary to hold the mutex supplied by the waiters and it is advantageous not to hold the lock to prevent immediate re-blocking. This function delegates to the underlying implementation.

Implements Os::ConditionVariableInterface.

Definition at line 24 of file Condition.cpp.

◆ operator=()

ConditionVariableInterface& Os::ConditionVariable::operator= ( const ConditionVariableInterface other)
overridevirtualdelete

assignment operator is forbidden

Reimplemented from Os::ConditionVariableInterface.

◆ wait()

void Os::ConditionVariable::wait ( Os::Mutex mutex)
overridevirtual

wait on a condition variable

Wait on a condition variable. This function will atomically unlock the provided mutex and block on the condition in one step. Blocking will occur until a future notify or notifyAll call is made to this variable on another thread of execution. This function delegates to the underlying implementation.

Warning
it is invalid to supply a mutex different from those supplied by others
conditions must be rechecked after the condition variable unlocks
Note
unlocked mutexes will be locked before waiting and will be relocked before this function returns
Parameters
mutexmutex to unlock as part of this operation

Implements Os::ConditionVariableInterface.

Definition at line 11 of file Condition.cpp.


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