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

Link-time delegating ConditionVariable implementation. More...

#include <Os/DelegateConditionVariable.hpp>

Inheritance diagram for Os::DelegateConditionVariable:
Os::ConditionVariableInterface

Public Member Functions

 DelegateConditionVariable ()
 default constructor More...
 
 ~DelegateConditionVariable () final
 default virtual destructor More...
 
 DelegateConditionVariable (const ConditionVariableInterface &other)=delete
 copy constructor is forbidden More...
 
 DelegateConditionVariable (const ConditionVariableInterface *other)=delete
 copy constructor is forbidden More...
 
ConditionVariableInterface & operator= (const ConditionVariableInterface &other) override=delete
 assignment operator is forbidden More...
 
Status pend (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...
 
ConditionVariableHandle * getHandle () 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...
 
void wait (Os::Mutex &mutex)
 wait on a condition variable and assert success More...
 

Additional Inherited Members

- Public Types inherited from Os::ConditionVariableInterface
enum  Status {
  OP_OK, ERROR_MUTEX_NOT_HELD, ERROR_DIFFERENT_MUTEX, ERROR_NOT_IMPLEMENTED,
  NOT_SUPPORTED, ERROR_OTHER
}
 
- Static Public Member Functions inherited from Os::ConditionVariableInterface
static ConditionVariableInterface * getDelegate (ConditionVariableHandleStorage &aligned_new_memory)
 provide a pointer to a ConditionVariable delegate object More...
 

Detailed Description

Link-time delegating ConditionVariable implementation.

Stores an implementation-defined condition variable handle in a byte array and forwards all operations to a delegate constructed (via placement-new) by ConditionVariableInterface::getDelegate(). Which getDelegate() is linked selects the concrete implementation at link time. This is the default binding of the Os::ConditionVariable alias; platforms may instead alias Os::ConditionVariable directly to a concrete implementation for compile-time selection (see config/OsSelection.hpp).

Definition at line 19 of file DelegateConditionVariable.hpp.

Constructor & Destructor Documentation

◆ DelegateConditionVariable() [1/3]

Os::DelegateConditionVariable::DelegateConditionVariable ( )

default constructor

Definition at line 9 of file DelegateConditionVariable.cpp.

◆ ~DelegateConditionVariable()

Os::DelegateConditionVariable::~DelegateConditionVariable ( )
final

default virtual destructor

Definition at line 12 of file DelegateConditionVariable.cpp.

◆ DelegateConditionVariable() [2/3]

Os::DelegateConditionVariable::DelegateConditionVariable ( const ConditionVariableInterface &  other)
delete

copy constructor is forbidden

◆ DelegateConditionVariable() [3/3]

Os::DelegateConditionVariable::DelegateConditionVariable ( const ConditionVariableInterface *  other)
delete

copy constructor is forbidden

Member Function Documentation

◆ getHandle()

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

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

Returns
internal task handle representation

Implements Os::ConditionVariableInterface.

Definition at line 33 of file DelegateConditionVariable.cpp.

◆ notify()

void Os::DelegateConditionVariable::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 24 of file DelegateConditionVariable.cpp.

◆ notifyAll()

void Os::DelegateConditionVariable::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 28 of file DelegateConditionVariable.cpp.

◆ operator=()

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

assignment operator is forbidden

Reimplemented from Os::ConditionVariableInterface.

◆ pend()

DelegateConditionVariable::Status Os::DelegateConditionVariable::pend ( 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
the mutex must be locked by the calling task
Parameters
mutexmutex to unlock as part of this operation
Returns
status of the conditional wait

Implements Os::ConditionVariableInterface.

Definition at line 16 of file DelegateConditionVariable.cpp.


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