mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-08-05 18:21:54 +00:00
Add mutex implementation using std::atomic_flag
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
|
Reference in New Issue
Block a user