7 #ifndef PXR_BASE_TF_SPIN_MUTEX_H
8 #define PXR_BASE_TF_SPIN_MUTEX_H
75 : _mutex(std::
exchange(other._mutex,
nullptr))
76 , _acquired(std::
exchange(other._acquired, false)) {}
149 bool _acquired =
false;
157 return _lockState.exchange(
true, std::memory_order_acquire) ==
false;
172 _lockState.store(
false, std::memory_order_release);
177 TF_API void _AcquireContended();
179 std::atomic<bool> _lockState;
184 #endif // PXR_BASE_TF_SPIN_MUTEX_H
void Release()
Release this thread's lock on this mutex.
static constexpr DeferAcquire deferAcquire
Tag value for deferred-acquisition ScopedLock construction.
#define PXR_NAMESPACE_OPEN_SCOPE
~ScopedLock()
If this scoped lock is acquired, Release() it.
#define TF_DEV_AXIOM(cond)
ScopedLock(ScopedLock &&other) noexcept
ScopedLock()=default
Construct a scoped lock not associated with a mutex.
void Acquire(TfSpinMutex &m)
ScopedLock(TfSpinMutex &m, TfSpinMutex::DeferAcquire)
VULKAN_HPP_CONSTEXPR_14 VULKAN_HPP_INLINE T exchange(T &obj, U &&newValue)
bool TryAcquire(TfSpinMutex &m)
#define PXR_NAMESPACE_CLOSE_SCOPE
ScopedLock & operator=(ScopedLock &&other) noexcept
TfSpinMutex()
Construct a mutex, initially unlocked.
ScopedLock(TfSpinMutex &m)
Construct a scoped lock for mutex m and acquire a lock.