Provides reliable unlocking of a mutex. More...
#include <Inventor/threads/SbThreadAutoLock.h>
Public Member Functions | |
SbThreadAutoLock (SbThreadMutex *mutex) | |
Creates a mutex "autolock" object and automatically calls the mutex lock method. | |
SbThreadAutoLock (SbThreadMutex &mutex) | |
Provides reliable unlocking of a mutex.
This class provides reliable unlocking of a mutex.
An SbThreadMutex object must be created separately. The address of the mutex object is passed to the constructor, which locks the mutex and saves a reference to the mutex object. The autolock object should be created on the stack, so each thread will have its own autolock. The destructor automatically unlocks the mutex.
Because the autolock object is created on the stack, it avoids the need to explicitly unlock the mutex at every point of exit from the function (a common source of errors). The mutex will be unlocked when the autolock goes out of scope.
Example:
SbThread, SbThreadAutoReadLock, SbThreadAutoWriteLock, SbThreadBarrier, SbThreadMutex, SbThreadRWMutex
Definition at line 72 of file SbThreadAutoLock.h.
|
inline |
Creates a mutex "autolock" object and automatically calls the mutex lock method.
The mutex will be automatically unlocked when the autolock object is destroyed.
Definition at line 78 of file SbThreadAutoLock.h.
|
inline |
Definition at line 85 of file SbThreadAutoLock.h.