23 constexpr Lock() =
default;
27 if (!
lock_.exchange(
true, std::memory_order_acquire))
36 return !
lock_.load(std::memory_order_relaxed)
37 && !
lock_.exchange(
true, std::memory_order_acquire);
#define UL_ALWAYS_INLINE
Definition Defines.h:68
Tiny, efficient spinlock that is optimized for short locking periods but will still intelligently yie...
Definition Lock.h:21
UL_ALWAYS_INLINE void unlock() noexcept
Definition Lock.h:40
UL_ALWAYS_INLINE void lock() noexcept
Definition Lock.h:25
void contended_lock() noexcept
UL_ALWAYS_INLINE bool try_lock() noexcept
Definition Lock.h:33
Lock(const Lock &)=delete
std::atomic< bool > lock_
Definition Lock.h:48
Lock & operator=(const Lock &)=delete
Definition StringSTL.h:158
std::lock_guard< Lock > LockHolder
Definition Lock.h:51