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