| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // ====================================================================== | ||
| 2 | // \title Os/DelegateConditionVariable.cpp | ||
| 3 | // \brief implementation of Os::DelegateConditionVariable (link-time delegating Os::ConditionVariable) | ||
| 4 | // ====================================================================== | ||
| 5 | #include "Os/DelegateConditionVariable.hpp" | ||
| 6 | #include "Fw/Types/Assert.hpp" | ||
| 7 | |||
| 8 | namespace Os { | ||
| 9 | ✗ | DelegateConditionVariable::DelegateConditionVariable() | |
| 10 | ✗ | : m_delegate(*ConditionVariableInterface::getDelegate(m_handle_storage)) {} | |
| 11 | |||
| 12 | ✗ | DelegateConditionVariable::~DelegateConditionVariable() { | |
| 13 | ✗ | m_delegate.~ConditionVariableInterface(); | |
| 14 | ✗ | } | |
| 15 | |||
| 16 | ✗ | DelegateConditionVariable::Status DelegateConditionVariable::pend(Os::Mutex& mutex) { | |
| 17 | ✗ | FW_ASSERT(&this->m_delegate == reinterpret_cast<ConditionVariableInterface*>(&this->m_handle_storage[0])); | |
| 18 | ✗ | if (this->m_lock != nullptr && this->m_lock != &mutex) { | |
| 19 | ✗ | return Status::ERROR_DIFFERENT_MUTEX; | |
| 20 | } | ||
| 21 | ✗ | this->m_lock = &mutex; | |
| 22 | ✗ | return this->m_delegate.pend(mutex); | |
| 23 | } | ||
| 24 | ✗ | void DelegateConditionVariable::notify() { | |
| 25 | ✗ | FW_ASSERT(&this->m_delegate == reinterpret_cast<ConditionVariableInterface*>(&this->m_handle_storage[0])); | |
| 26 | ✗ | this->m_delegate.notify(); | |
| 27 | ✗ | } | |
| 28 | ✗ | void DelegateConditionVariable::notifyAll() { | |
| 29 | ✗ | FW_ASSERT(&this->m_delegate == reinterpret_cast<ConditionVariableInterface*>(&this->m_handle_storage[0])); | |
| 30 | ✗ | this->m_delegate.notifyAll(); | |
| 31 | ✗ | } | |
| 32 | |||
| 33 | ✗ | ConditionVariableHandle* DelegateConditionVariable::getHandle() { | |
| 34 | ✗ | FW_ASSERT(&this->m_delegate == reinterpret_cast<const ConditionVariableInterface*>(&this->m_handle_storage[0])); | |
| 35 | ✗ | return this->m_delegate.getHandle(); | |
| 36 | } | ||
| 37 | |||
| 38 | } // namespace Os | ||
| 39 |