| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "Os/Condition.hpp" | ||
| 2 | #include "Fw/Types/Assert.hpp" | ||
| 3 | |||
| 4 | namespace Os { | ||
| 5 |
1/1✓ Branch 14 taken 2971 times.
|
2971 | ConditionVariable::ConditionVariable() : m_delegate(*ConditionVariableInterface::getDelegate(m_handle_storage)) {} |
| 6 | |||
| 7 | 5944 | ConditionVariable::~ConditionVariable() { | |
| 8 | 5942 | m_delegate.~ConditionVariableInterface(); | |
| 9 | 5944 | } | |
| 10 | |||
| 11 | 14 | ConditionVariable::Status ConditionVariable::pend(Os::Mutex& mutex) { | |
| 12 | 14 | FW_ASSERT(&this->m_delegate == reinterpret_cast<ConditionVariableInterface*>(&this->m_handle_storage[0])); | |
| 13 |
3/4✓ Branch 4 taken 3 times.
✓ Branch 5 taken 11 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 3 times.
|
14 | if (this->m_lock != nullptr && this->m_lock != &mutex) { |
| 14 | ✗ | return Status::ERROR_DIFFERENT_MUTEX; | |
| 15 | }; | ||
| 16 | 14 | this->m_lock = &mutex; | |
| 17 | 14 | return this->m_delegate.pend(mutex); | |
| 18 | } | ||
| 19 | 12 | void ConditionVariable::wait(Os::Mutex& mutex) { | |
| 20 | 12 | Status status = this->pend(mutex); | |
| 21 | 12 | FW_ASSERT(status == Status::OP_OK, static_cast<FwAssertArgType>(status)); | |
| 22 | 12 | } | |
| 23 | 257054 | void ConditionVariable::notify() { | |
| 24 | 257054 | FW_ASSERT(&this->m_delegate == reinterpret_cast<ConditionVariableInterface*>(&this->m_handle_storage[0])); | |
| 25 | 257054 | this->m_delegate.notify(); | |
| 26 | 257054 | } | |
| 27 | 2 | void ConditionVariable::notifyAll() { | |
| 28 | 2 | FW_ASSERT(&this->m_delegate == reinterpret_cast<ConditionVariableInterface*>(&this->m_handle_storage[0])); | |
| 29 | 2 | this->m_delegate.notifyAll(); | |
| 30 | 2 | } | |
| 31 | |||
| 32 | 1 | ConditionVariableHandle* ConditionVariable::getHandle() { | |
| 33 | 1 | FW_ASSERT(&this->m_delegate == reinterpret_cast<const ConditionVariableInterface*>(&this->m_handle_storage[0])); | |
| 34 | 1 | return this->m_delegate.getHandle(); | |
| 35 | } | ||
| 36 | |||
| 37 | } // namespace Os | ||
| 38 |