mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-08-06 10:27:34 +00:00
Move atomic implementations
This commit is contained in:
25
include/sta/atomic/mutex.hpp
Normal file
25
include/sta/atomic/mutex.hpp
Normal 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
|
27
include/sta/atomic/signal.hpp
Normal file
27
include/sta/atomic/signal.hpp
Normal 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
|
Reference in New Issue
Block a user