A mutual exclusion lock that busy-waits when locking.
More...
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 |
| 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).
| void G3D::Spinlock::unlock |
( |
| ) |
|
|
inline |