LocalSynchronizer Class Reference

Tool for locally managing synchronization. More...

#include <IThread.hpp>

Public Member Functions

 LocalSynchronizer (ISynchronizer *ref)
 ~LocalSynchronizer ()

Detailed Description

Tool for locally managing synchronization.

Instances of this class reference a ISynchronizer instance. When created, they lock their referred ISynchronizer and when destroyed, they unlock it.

For instance, it is a convenient way to lock/unlock a ISynchronizer instance in the scope of a statements block (where the LocalSynchronizer instance lives), a particular case being the statements block of a method.

Code sample:

void sample (ISynchronizer* synchronizer)
// we create a local synchronizer from the provided argument
LocalSynchronizer localsynchro (synchronizer);
// now, all the statements block is locked for the provided synchronizer
// in other word, this sample function is protected against concurrent accesses.

Constructor & Destructor Documentation

LocalSynchronizer ( ISynchronizer ref)


[in]ref: the ISynchronizer instance to be controlled.
~LocalSynchronizer ( )


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