Portable spinlock class. More...
#include <Inventor/threads/SbThreadSpinlock.h>
Public Member Functions | |
SbThreadSpinlock () | |
~SbThreadSpinlock () | |
void | lock () |
void | unlock () |
This class provides a portable "spinlock". It is implemented using the pthreads API on UNIX/Linux and the Win32 API on Microsoft Windows.
A spinlock can be used just like a mutex to protect access to critical data or code that is used by multiple threads. In some cases a spinlock may be more efficient than a mutex. But note that this class may be implemented using a mutex if there is no native support, which is currently the case on UNIX/Linux.
It is not necessary to use this class in order to use multiple threads with Open Inventor. It is provided only as a convenience. (However, note that you should use pthreads on UNIX/Linux and Win32 on Windows to be certain of compatibility with Open Inventor.)
SbThread, SbThreadAutoLock, SbThreadBarrier, SbThreadMutex
SbThreadSpinlock::SbThreadSpinlock | ( | ) |
Create a spinlock.
SbThreadSpinlock::~SbThreadSpinlock | ( | ) |
Destructor.
void SbThreadSpinlock::lock | ( | ) |
Request exclusive access for this spinlock.
void SbThreadSpinlock::unlock | ( | ) |
Release exclusive access.