/** * @file * @brief Mutex interface definition. */ #ifndef STA_CORE_MUTEX_HPP #define STA_CORE_MUTEX_HPP #include /** * @brief Maximum timeout for a mutex. * */ #define STA_MUTEX_MAX_TIMEOUT 0xFFFFFFFFU namespace sta { /** * @brief Interface for mutex objects. * * @ingroup sta_core */ class Mutex { public: /** * @brief Method for checking mutex ownership. * * @return Returns true if the currently running thread is the owner of the mutex. */ virtual bool isCurrentThreadOwner() = 0; /** * @brief Block until mutex has been acquired. */ virtual void acquire(uint32_t timeout = STA_MUTEX_MAX_TIMEOUT) = 0; /** * @brief Release mutex. */ virtual void release() = 0; static Mutex * ALWAYS_FREE; /**< Fake mutex that can always be acquired */ }; } // namespace sta #endif // STA_CORE_MUTEX_HPP