29 #ifndef PIRANHA_DETAIL_ATOMIC_LOCK_GUARD_HPP 30 #define PIRANHA_DETAIL_ATOMIC_LOCK_GUARD_HPP 45 struct atomic_lock_guard {
46 explicit atomic_lock_guard(std::atomic_flag &af) : m_af(af)
48 while (m_af.test_and_set(std::memory_order_acquire)) {
53 m_af.clear(std::memory_order_release);
56 atomic_lock_guard() =
delete;
57 atomic_lock_guard(
const atomic_lock_guard &) =
delete;
58 atomic_lock_guard(atomic_lock_guard &&) =
delete;
59 atomic_lock_guard &operator=(
const atomic_lock_guard &) =
delete;
60 atomic_lock_guard &operator=(atomic_lock_guard &&) =
delete;
62 std::atomic_flag &m_af;