![]() |
|
Scoped lock utility class. More...
#include <spinMutex.h>
Public Member Functions | |
| ScopedLock (TfSpinMutex &m) | |
Construct a scoped lock for mutex m and acquire a lock. | |
| ScopedLock ()=default | |
Construct a scoped lock not associated with a mutex. | |
| ~ScopedLock () | |
| If this scoped lock is acquired, Release() it. | |
| void | Acquire (TfSpinMutex &m) |
If the current scoped lock is acquired, Release() it, then associate this lock with m and acquire a lock. | |
| void | Release () |
| Release the currently required lock on the associated mutex. | |
| void | Acquire () |
| Acquire a lock on this lock's associated mutex. | |
| bool | TryAcquire (TfSpinMutex &m) |
If the current scoped lock is acquired, Release() it, then associate this lock with m and try to acquire a lock. | |
| bool | TryAcquire () |
| Try to acquire a lock on this lock's associated mutex. | |
Scoped lock utility class.
API modeled roughly after tbb::spin_rw_mutex::scoped_lock.
Definition at line 50 of file spinMutex.h.
|
inlineexplicit |
Construct a scoped lock for mutex m and acquire a lock.
Definition at line 53 of file spinMutex.h.
|
default |
Construct a scoped lock not associated with a mutex.
|
inline |
If this scoped lock is acquired, Release() it.
Definition at line 61 of file spinMutex.h.
|
inline |
Acquire a lock on this lock's associated mutex.
This lock must not already be acquired when calling Acquire().
Definition at line 83 of file spinMutex.h.
|
inline |
If the current scoped lock is acquired, Release() it, then associate this lock with m and acquire a lock.
Definition at line 67 of file spinMutex.h.
|
inline |
Release the currently required lock on the associated mutex.
If this lock is not currently acquired, do nothing.
Definition at line 75 of file spinMutex.h.
|
inline |
Try to acquire a lock on this lock's associated mutex.
The lock must not already be acquired when calling TryAcquire(). Return true if the lock was successfully acquired, false if not.
Definition at line 102 of file spinMutex.h.
|
inline |
If the current scoped lock is acquired, Release() it, then associate this lock with m and try to acquire a lock.
Return true if the lock was successfully acquired, false if not.
Definition at line 93 of file spinMutex.h.