sta-core/include/sta/mutex.hpp
2024-05-24 16:27:53 +02:00

51 lines
978 B
C++

/**
* @file
* @brief Mutex interface definition.
*/
#ifndef STA_CORE_MUTEX_HPP
#define STA_CORE_MUTEX_HPP
#include <mutex>
namespace sta
{
/**
* @brief Hippity hoppity, this is now namespace sta's property.
*/
using std::lock_guard;
/**
* @brief Interface for mutex objects.
*
* @ingroup sta_core
*/
class Mutex
{
public:
/**
* @brief Block until mutex has been acquired.
*/
virtual void acquire() = 0;
/**
* @brief Release mutex.
*/
virtual void release() = 0;
/**
* @brief Identical to acquire(). Added for compatibility with std::lock_guard.
*/
void lock();
/**
* @brief Identical to release(). Added for compatibility with std::lock_guard.
*/
void unlock();
static Mutex * ALWAYS_FREE; /**< Fake mutex that can always be acquired */
};
} // namespace sta
#endif // STA_CORE_MUTEX_HPP