OESpinlock

struct OESpinlock

The OESpinlock class provides a portable mutual exclusion device, that is useful for protecting shared data structures from concurrent modification. It provides the exact same semantics as a OEMutex object, however, it has very different performance semantics. Spin locks will optimistically continually try to acquire the lock in a tight loop. OEMutex will typically yield the processor back to the operating system. Spin locks are useful to protect very cheap operations.

See also

Constructors

OESpinlock()

Default constructor.

Acquire

void Acquire()

Acquires (locks) the OESpinlock. If the OESpinlock is unlocked, it is locked by this thread and becomes owned by the calling thread. If the OESpinlock is already locked, by this or another thread, OESpinlock.Acquire spins in a tight loop until the OESpinlock is released. No attempt is made at fairness between threads.

Release

void Release()

Releases (unlocks) the OESpinlock.