Support Forum       Library Source       SourceForge Page       G3D Web Page     
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
G3D::Spinlock Class Reference

A mutual exclusion lock that busy-waits when locking. More...

Public Member Functions

 Spinlock ()
 
bool lock ()
 Busy waits until the lock is unlocked, then locks it exclusively.
 
void unlock ()
 

Detailed Description

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

Constructor & Destructor Documentation

G3D::Spinlock::Spinlock ( )
inline

Member Function Documentation

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

documentation generated on Sat Jan 12 2013 22:49:57 using doxygen 1.8.2