F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
DelegateConditionVariable.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title Os/DelegateConditionVariable.hpp
3 // \brief Define the Os::DelegateConditionVariable class
4 // ======================================================================
5 #ifndef OS_DELEGATECONDITIONVARIABLE_HPP_
6 #define OS_DELEGATECONDITIONVARIABLE_HPP_
7 
9 
10 namespace Os {
11 
20  public:
23 
26 
29 
32 
34  ConditionVariableInterface& operator=(const ConditionVariableInterface& other) override = delete;
35 
48  Status pend(Os::Mutex& mutex) override;
49 
55  void notify() override;
56 
62  void notifyAll() override;
63 
67 
68  private:
70  Os::Mutex* m_lock = nullptr;
71 
72  // This section is used to store the implementation-defined condition variable handle. To Os::ConditionVariable
73  // and fprime, this type is opaque and thus normal allocation cannot be done. Instead, we allow the implementor to
74  // store the handle in the byte-array here and set `handle` to that address for storage.
75  alignas(FW_HANDLE_ALIGNMENT)
76  ConditionVariableHandleStorage m_handle_storage;
77  ConditionVariableInterface& m_delegate;
78 };
79 
80 } // namespace Os
81 
82 #endif // OS_DELEGATECONDITIONVARIABLE_HPP_
void notify() override
notify a single waiter on this condition variable
~DelegateConditionVariable() final
default virtual destructor
DelegateConditionVariable()
default constructor
Link-time delegating Mutex implementation.
U8 ConditionVariableHandleStorage[FW_CONDITION_VARIABLE_HANDLE_MAX_SIZE]
Definition: Os.hpp:18
Status pend(Os::Mutex &mutex) override
wait on a condition variable
interface for condition variables
ConditionVariableInterface & operator=(const ConditionVariableInterface &other) override=delete
assignment operator is forbidden
ConditionVariableHandle * getHandle() override
return the underlying condition variable handle (implementation specific). Delegates to implementatio...
Link-time delegating ConditionVariable implementation.
void notifyAll() override
notify all waiters on this condition variable
Condition variable handle parent.