| 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 10060 times.
|
10060 | 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 | 10060 | FW_ASSERT(&this->m_delegate == reinterpret_cast<MutexInterface*>(&this->m_handle_storage[0])); | |
| 17 | 10060 | } | |
| 18 | |||
| 19 | 20122 | DelegateMutex::~DelegateMutex() { | |
| 20 | 20120 | FW_ASSERT(&this->m_delegate == reinterpret_cast<MutexInterface*>(&this->m_handle_storage[0])); | |
| 21 | 20120 | m_delegate.~MutexInterface(); | |
| 22 | 20122 | } | |
| 23 | |||
| 24 | 12 | MutexHandle* DelegateMutex::getHandle() { | |
| 25 | 12 | FW_ASSERT(&this->m_delegate == reinterpret_cast<MutexInterface*>(&this->m_handle_storage[0])); | |
| 26 | 12 | return this->m_delegate.getHandle(); | |
| 27 | } | ||
| 28 | |||
| 29 | 13493595 | DelegateMutex::Status DelegateMutex::take() { | |
| 30 | 13493595 | FW_ASSERT(&this->m_delegate == reinterpret_cast<MutexInterface*>(&this->m_handle_storage[0])); | |
| 31 | 16401961 | return this->m_delegate.take(); | |
| 32 | } | ||
| 33 | |||
| 34 | 13526998 | DelegateMutex::Status DelegateMutex::release() { | |
| 35 | 13526998 | FW_ASSERT(&this->m_delegate == reinterpret_cast<MutexInterface*>(&this->m_handle_storage[0])); | |
| 36 | 17289761 | return this->m_delegate.release(); | |
| 37 | } | ||
| 38 | |||
| 39 | } // namespace Os | ||
| 40 |