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