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

FX::FXScopedMutex Class Reference

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

#include <FXMutex.h>

Public Member Functions

 FXScopedMutex (FXMutex &m)
 Construct and lock associated mutex.
 
FXMutexmutex ()
 Return reference to associated mutex.
 
void lock ()
 Lock mutex.
 
FXbool trylock ()
 Return true if succeeded locking the mutex.
 
FXbool locked ()
 Return true if mutex is already locked.
 
void unlock ()
 Unlock mutex.
 
 ~FXScopedMutex ()
 Destroy and unlock associated mutex.
 

Detailed Description

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

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