Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FX::FXScopedSpinLock Class Reference

Establish a correspondence between a C++ scope and an FXSpinLock, so that entering and leaving the scope in which the scoped lock is defined will automatically lock and unlock the associated spin lock. More...

#include <FXSpinLock.h>

Public Member Functions

 FXScopedSpinLock (FXSpinLock &s)
 Construct & lock associated spinlock.
 
FXSpinLockspinlock ()
 Return reference to associated spinlock.
 
void lock ()
 Lock spinlock.
 
FXbool trylock ()
 Return true if succeeded locking the spinlock.
 
FXbool locked ()
 Return true if spinlock is already locked.
 
void unlock ()
 Unlock spin lock.
 
 ~FXScopedSpinLock ()
 Destroy and unlock associated spinlock.
 

Detailed Description

Establish a correspondence between a C++ scope and an FXSpinLock, so that entering and leaving the scope in which the scoped lock is defined will automatically lock and unlock the associated spin lock.

This will typically result in much less coding, and in addition will make the code safe from exceptions.


The documentation for this class was generated from the following file:

Copyright © 1997-2022 Jeroen van der Zijp