Loading...
Searching...
No Matches
TfSpinMutex::ScopedLock Struct Reference

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 ()
 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.
 

Detailed Description

Scoped lock utility class.

API modeled roughly after tbb::spin_rw_mutex::scoped_lock.

Definition at line 67 of file spinMutex.h.

Constructor & Destructor Documentation

◆ ScopedLock() [1/2]

ScopedLock ( TfSpinMutex m)
inlineexplicit

Construct a scoped lock for mutex m and acquire a lock.

Definition at line 70 of file spinMutex.h.

◆ ScopedLock() [2/2]

ScopedLock ( )
inline

Construct a scoped lock not associated with a mutex.

Definition at line 77 of file spinMutex.h.

◆ ~ScopedLock()

~ScopedLock ( )
inline

If this scoped lock is acquired, Release() it.

Definition at line 80 of file spinMutex.h.

Member Function Documentation

◆ Acquire() [1/2]

void Acquire ( )
inline

Acquire a lock on this lock's associated mutex.

This lock must not already be acquired when calling Acquire().

Definition at line 102 of file spinMutex.h.

◆ Acquire() [2/2]

void Acquire ( TfSpinMutex m)
inline

If the current scoped lock is acquired, Release() it, then associate this lock with m and acquire a lock.

Definition at line 86 of file spinMutex.h.

◆ Release()

void Release ( )
inline

Release the currently required lock on the associated mutex.

If this lock is not currently acquired, silently do nothing.

Definition at line 94 of file spinMutex.h.


The documentation for this struct was generated from the following file: