A mutual exclusion lock that busy-waits when locking.
More...
#include <GMutex.h>
A mutual exclusion lock that busy-waits when locking.
On a machine with one (significant) thread per processor core, a Spinlock may be substantially faster than a mutex.
- See also
- G3D::GThread, G3D::GMutex, G3D::AtomicInt32
G3D::Spinlock::Spinlock |
( |
| ) |
|
|
inline |
AtomicInt32 x
Definition: GMutex.h:39
bool G3D::Spinlock::lock |
( |
| ) |
|
|
inline |
Busy waits until the lock is unlocked, then locks it exclusively. Returns true if the lock succeeded on the first try (indicating no contention).
Unlike a G3D::GMutex, a single thread cannot re-enter Spinlock::lock() that it already locked.
AtomicInt32 x
Definition: GMutex.h:39
int32 compareAndSet(const int32 comperand, const int32 exchange)
Definition: AtomicInt32.h:142
void G3D::Spinlock::unlock |
( |
| ) |
|
|
inline |
AtomicInt32 x
Definition: GMutex.h:39
int32 compareAndSet(const int32 comperand, const int32 exchange)
Definition: AtomicInt32.h:142
The documentation for this class was generated from the following file: