| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // ====================================================================== | ||
| 2 | // \title Os/DelegateMutex.cpp | ||
| 3 | // \brief implementation of Os::DelegateMutex (link-time delegating Os::Mutex) | ||
| 4 | // ====================================================================== | ||
| 5 | #include <Fw/Types/Assert.hpp> | ||
| 6 | #include <Os/DelegateMutex.hpp> | ||
| 7 | |||
| 8 | namespace Os { | ||
| 9 | |||
| 10 | // ---------------------------------------------------------------------- | ||
| 11 | // DelegateMutex: link-time delegating implementation | ||
| 12 | // ---------------------------------------------------------------------- | ||
| 13 | |||
| 14 |
1/1✓ Branch 10 taken 5 times.
|
5 | DelegateMutex::DelegateMutex() : m_delegate(*MutexInterface::getDelegate(m_handle_storage)) { |
| 15 | // m_handle_storage is placement-new storage populated by getDelegate(); do not value-initialize it (#5297) | ||
| 16 | 5 | FW_ASSERT(&this->m_delegate == reinterpret_cast<MutexInterface*>(&this->m_handle_storage[0])); | |
| 17 | 5 | } | |
| 18 | |||
| 19 | 10 | DelegateMutex::~DelegateMutex() { | |
| 20 | 10 | FW_ASSERT(&this->m_delegate == reinterpret_cast<MutexInterface*>(&this->m_handle_storage[0])); | |
| 21 | 10 | m_delegate.~MutexInterface(); | |
| 22 | 10 | } | |
| 23 | |||
| 24 | ✗ | MutexHandle* DelegateMutex::getHandle() { | |
| 25 | ✗ | FW_ASSERT(&this->m_delegate == reinterpret_cast<MutexInterface*>(&this->m_handle_storage[0])); | |
| 26 | ✗ | return this->m_delegate.getHandle(); | |
| 27 | } | ||
| 28 | |||
| 29 | 1 | DelegateMutex::Status DelegateMutex::take() { | |
| 30 | 1 | FW_ASSERT(&this->m_delegate == reinterpret_cast<MutexInterface*>(&this->m_handle_storage[0])); | |
| 31 | 1 | return this->m_delegate.take(); | |
| 32 | } | ||
| 33 | |||
| 34 | 1 | DelegateMutex::Status DelegateMutex::release() { | |
| 35 | 1 | FW_ASSERT(&this->m_delegate == reinterpret_cast<MutexInterface*>(&this->m_handle_storage[0])); | |
| 36 | 1 | return this->m_delegate.release(); | |
| 37 | } | ||
| 38 | |||
| 39 | } // namespace Os | ||
| 40 |