Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
|
FXSpinLock can be used to provide safe access to very small critical sections. More...
#include <FXSpinLock.h>
Public Member Functions | |
FXSpinLock () | |
Initialize the spinlock. | |
void | lock () |
Lock the spinlock. | |
FXbool | trylock () |
Return true if succeeded locking the spinlock. | |
FXbool | locked () |
Return true if spinlock is already locked. | |
void | unlock () |
Unlock spinlock. | |
~FXSpinLock () | |
Delete the spinlock. | |
FXSpinLock can be used to provide safe access to very small critical sections.
Similar to FXMutex, a FXSpinLock provides safe access to a critical section shared by multiple threads. Unlike FXMutex, however, a thread which is unable to obtain the lock will not block, but spin in a tight loop until the lock can be obtained. The advantage of FXSpinLock over FXMutex is that no operating system calls are performed suspending and resuming the calling thread.
Copyright © 1997-2022 Jeroen van der Zijp |