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

FXEX::FXSynchronise Class Reference

A Synchronise class serialises access to the class resources, during the current block scope. More...

#include <FXSynchronise.h>

List of all members.

Public Methods

 FXSynchronise (FXLockable &l)
 FXSynchronise (FXRunnable &r)
 ~FXSynchronise ()


Detailed Description

A Synchronise class serialises access to the class resources, during the current block scope.

This has the advantage that mutex.unlock() will be called automatically when an exception is thrown, ie. the 'synchronise' goes out of scope. ie. auto lock/unlock of mutex

As an alternative to: { mutex.lock(); ..... mutex.unlock(); }

you can use a single instance of the FXSynchronise class: { FXSynchronise(mutex); .... }

for cases in FXRunnable derived classes, you could use the FXSYNCHRONISE macro in FXThread derived clases: { FXSYNCHRONISE ... }

Definition at line 60 of file FXSynchronise.h.


Constructor & Destructor Documentation

FXEX::FXSynchronise::FXSynchronise FXLockable & l [inline]
 

on construction, lock the lockable.

Definition at line 63 of file FXSynchronise.h.

FXEX::FXSynchronise::FXSynchronise FXRunnable & r [inline]
 

lock the mutex using the FXSYNCHRONISE macro.

Definition at line 66 of file FXSynchronise.h.

FXEX::FXSynchronise::~FXSynchronise [inline]
 

unlock the lockable on destruction.

Definition at line 69 of file FXSynchronise.h.