| 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 | 58 | DelegateConditionVariable::DelegateConditionVariable() | |
| 10 |
1/1✓ Branch 2 taken 58 times.
|
58 | : m_delegate(*ConditionVariableInterface::getDelegate(m_handle_storage)) {} |
| 11 | |||
| 12 | 116 | DelegateConditionVariable::~DelegateConditionVariable() { | |
| 13 | 116 | m_delegate.~ConditionVariableInterface(); | |
| 14 | 116 | } | |
| 15 | |||
| 16 | 5126 | DelegateConditionVariable::Status DelegateConditionVariable::pend(Os::Mutex& mutex) { | |
| 17 | 5126 | FW_ASSERT(&this->m_delegate == reinterpret_cast<ConditionVariableInterface*>(&this->m_handle_storage[0])); | |
| 18 |
3/4✓ Branch 0 taken 5104 times.
✓ Branch 1 taken 22 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5104 times.
|
5126 | if (this->m_lock != nullptr && this->m_lock != &mutex) { |
| 19 | ✗ | return Status::ERROR_DIFFERENT_MUTEX; | |
| 20 | } | ||
| 21 | 5126 | this->m_lock = &mutex; | |
| 22 | 5126 | return this->m_delegate.pend(mutex); | |
| 23 | } | ||
| 24 | 15251 | void DelegateConditionVariable::notify() { | |
| 25 | 15251 | FW_ASSERT(&this->m_delegate == reinterpret_cast<ConditionVariableInterface*>(&this->m_handle_storage[0])); | |
| 26 | 15251 | this->m_delegate.notify(); | |
| 27 | 15239 | } | |
| 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 |