mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/sta-core.git
synced 2025-06-12 01:25:59 +00:00
24 lines
305 B
C++
24 lines
305 B
C++
#include <sta/atomic/mutex.hpp>
|
|
#ifdef STA_ATOMIC_ENABLE
|
|
|
|
|
|
namespace sta
|
|
{
|
|
AtomicMutex::AtomicMutex()
|
|
: lock_{ATOMIC_FLAG_INIT}
|
|
{}
|
|
|
|
void AtomicMutex::acquire()
|
|
{
|
|
while (lock_.test_and_set());
|
|
}
|
|
|
|
void AtomicMutex::release()
|
|
{
|
|
lock_.clear();
|
|
}
|
|
} // namespace sta
|
|
|
|
|
|
#endif // STA_ATOMIC_ENABLE
|