Move atomic implementations

This commit is contained in:
Henrik Stickann
2022-04-10 20:36:46 +02:00
parent 46cd2417e3
commit 4bf8a31acf
4 changed files with 2 additions and 2 deletions

View File

@@ -0,0 +1,25 @@
#ifndef STA_ATOMIC_MUTEX_HPP
#define STA_ATOMIC_MUTEX_HPP
#include <sta/mutex.hpp>
#include <atomic>
namespace sta
{
class AtomicMutex : public Mutex
{
public:
AtomicMutex();
void acquire() override;
void release() override;
private:
std::atomic_flag lock_;
};
} // namespace sta
#endif // STA_ATOMIC_MUTEX_HPP

View File

@@ -0,0 +1,27 @@
#ifndef STA_ATOMIC_SIGNAL_HPP
#define STA_ATOMIC_SIGNAL_HPP
#include <sta/signal.hpp>
#include <atomic>
namespace sta
{
class AtomicSignal : public Signal
{
public:
AtomicSignal();
void notify() override;
bool peek() override;
bool test() override;
void wait() override;
private:
std::atomic<bool> signal_;
};
} // namespace sta
#endif // STA_ATOMIC_SIGNAL_HPP