| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // ====================================================================== | ||
| 2 | // \title Os/Stub/ConditionVariable.hpp | ||
| 3 | // \brief Stub definitions for Os::ConditionVariable | ||
| 4 | // ====================================================================== | ||
| 5 | #ifndef OS_STUB_CONDITION_VARIABLE_HPP | ||
| 6 | #define OS_STUB_CONDITION_VARIABLE_HPP | ||
| 7 | #include <Os/Condition.hpp> | ||
| 8 | |||
| 9 | namespace Os { | ||
| 10 | namespace Stub { | ||
| 11 | namespace Mutex { | ||
| 12 | |||
| 13 | struct StubConditionVariableHandle : public ConditionVariableHandle {}; | ||
| 14 | |||
| 15 | //! \brief Stub implementation of Os::ConditionVariable | ||
| 16 | //! | ||
| 17 | //! Stub implementation of `ConditionVariable` for use as a delegate class handling error-only file operations. | ||
| 18 | //! | ||
| 19 | class StubConditionVariable : public ConditionVariableInterface { | ||
| 20 | public: | ||
| 21 | //! \brief constructor | ||
| 22 | //! | ||
| 23 | ✗ | StubConditionVariable() = default; | |
| 24 | |||
| 25 | //! \brief destructor | ||
| 26 | //! | ||
| 27 | ✗ | ~StubConditionVariable() override = default; | |
| 28 | |||
| 29 | //! \brief assignment operator is forbidden | ||
| 30 | ConditionVariableInterface& operator=(const ConditionVariableInterface& other) override = delete; | ||
| 31 | |||
| 32 | //! \brief wait releasing mutex | ||
| 33 | StubConditionVariable::Status pend(Os::Mutex& mutex) override; | ||
| 34 | |||
| 35 | //! \brief notify a single waiter | ||
| 36 | void notify() override; | ||
| 37 | |||
| 38 | //! \brief notify all current waiters | ||
| 39 | void notifyAll() override; | ||
| 40 | |||
| 41 | //! \brief get handle | ||
| 42 | ConditionVariableHandle* getHandle() override; | ||
| 43 | |||
| 44 | private: | ||
| 45 | //! Handle for PosixMutex | ||
| 46 | StubConditionVariableHandle m_handle; | ||
| 47 | }; | ||
| 48 | |||
| 49 | } // namespace Mutex | ||
| 50 | } // namespace Stub | ||
| 51 | } // namespace Os | ||
| 52 | #endif // OS_STUB_CONDITION_VARIABLE_HPP | ||
| 53 |