7#ifndef PXR_BASE_TF_SPIN_MUTEX_H
8#define PXR_BASE_TF_SPIN_MUTEX_H
11#include "pxr/base/tf/api.h"
18PXR_NAMESPACE_OPEN_SCOPE
108 return _lockState.exchange(
true, std::memory_order_acquire) ==
false;
123 _lockState.store(
false, std::memory_order_release);
128 TF_API
void _AcquireContended();
130 std::atomic<bool> _lockState;
133PXR_NAMESPACE_CLOSE_SCOPE
This class implements a simple spin lock that emphasizes throughput when there is little to no conten...
TfSpinMutex()
Construct a mutex, initially unlocked.
void Release()
Release this thread's lock on this mutex.
void Acquire()
Acquire a lock on this mutex.
bool TryAcquire()
Acquire a lock on this mutex if it is not currently held by another thread.
Stripped down version of diagnostic.h that doesn't define std::string.
#define TF_DEV_AXIOM(cond)
The same as TF_AXIOM, but compiled only in dev builds.
Scoped lock utility class.
ScopedLock()
Construct a scoped lock not associated with a mutex.
void Acquire(TfSpinMutex &m)
If the current scoped lock is acquired, Release() it, then associate this lock with m and acquire a l...
void Release()
Release the currently required lock on the associated mutex.
ScopedLock(TfSpinMutex &m)
Construct a scoped lock for mutex m and acquire a lock.
void Acquire()
Acquire a lock on this lock's associated mutex.
~ScopedLock()
If this scoped lock is acquired, Release() it.