27 _flag ATOMIC_FLAG_INIT
33 while (_flag.test_and_set(std::memory_order_acquire));
39 return !_flag.test_and_set(std::memory_order_acquire);
45 _flag.clear(std::memory_order_release);
75 _ownsLock = _spinlock.tryLock();
Guard(SpinLock &lock)
Construct this object and lock the passed-in spinlock.
Definition: quantum_spinlock_impl.h:49
void lock()
Locks this object.
Definition: quantum_buffer_impl.h:22
~Guard()
Destroy this object and unlock the underlying spinlock.
Definition: quantum_spinlock_impl.h:64
~ReverseGuard()
Acquire the underlying spinlock.
Definition: quantum_spinlock_impl.h:102
SpinLock()
Constructor. The object is in the unlocked state.
Definition: quantum_spinlock_impl.h:26
ReverseGuard(SpinLock &lock)
Release the passed-in spinlock.
Definition: quantum_spinlock_impl.h:95
bool tryLock()
Try to acquire the underlying spinlock.
Definition: quantum_spinlock_impl.h:72
bool ownsLock() const
Indicates if this object owns the underlying spinlock.
Definition: quantum_spinlock_impl.h:90
std::try_to_lock_t TryToLock
Definition: quantum_spinlock.h:34
void lock()
Acquire the underlying spinlock.
Definition: quantum_spinlock_impl.h:81
void unlock()
Unlocks the current object.
Definition: quantum_spinlock_impl.h:43
bool tryLock()
Attempt to acquire the lock.
Definition: quantum_spinlock_impl.h:37