Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members | Related Pages

LOW_objectSynchronizer Class Reference

Mix-in class to synchronize access to methods on object basis. More...

#include <LOW_objectSynchronizer.h>

Inheritance diagram for LOW_objectSynchronizer:

Inheritance graph
[legend]
Collaboration diagram for LOW_objectSynchronizer:

Collaboration graph
[legend]
List of all members.

Public Member Functions

LOW_objectSynchronizeroperator= (const LOW_objectSynchronizer &inRightSide)

Protected Member Functions

 LOW_objectSynchronizer ()
 Constructor.

 LOW_objectSynchronizer (const LOW_objectSynchronizer &inObjectSynchronizer)
 Copy constructor.

virtual ~LOW_objectSynchronizer ()
 Destructor.


Private Attributes

LOW_thread_rwlockobjectSyncRwlock
 Rwlock used for locking.

LOW_platformMiscFactory::threadIdent_t writeLockHolder
 Thread id of the one who's holding a write lock.


Friends

class __synchronizeMethodRead
class __synchronizeMethodWrite
class __synchronizeMethodReadWeak
class __synchronizeMethodWriteWeak

Detailed Description

Mix-in class to synchronize access to methods on object basis.

A class which needs synchronization to be thread-save can subclass this class. To serialize the access to a method, simply insert one of the following macros at the beginning of the method:

Note that synchronization is done on object basis.

The implemtation follows the "locking is creation" design pattern and uses a read-write lock. Therefore reentrant calls or successive locking in sub-called methods does no harm.

For locking in static methods some preprocessor macros are provided:

This class is thread-safe.

Author:
Harald Roelle

Definition at line 67 of file LOW_objectSynchronizer.h.


Constructor & Destructor Documentation

LOW_objectSynchronizer::LOW_objectSynchronizer  )  [protected]
 

Constructor.

Definition at line 27 of file LOW_objectSynchronizer.cpp.

References LOW_thread_Factory::new_rwlock(), objectSyncRwlock, and writeLockHolder.

LOW_objectSynchronizer::LOW_objectSynchronizer const LOW_objectSynchronizer inObjectSynchronizer  )  [protected]
 

Copy constructor.

Definition at line 34 of file LOW_objectSynchronizer.cpp.

References LOW_thread_Factory::new_rwlock(), objectSyncRwlock, and writeLockHolder.

LOW_objectSynchronizer::~LOW_objectSynchronizer  )  [protected, virtual]
 

Destructor.

Definition at line 41 of file LOW_objectSynchronizer.cpp.

References objectSyncRwlock.


Member Function Documentation

LOW_objectSynchronizer & LOW_objectSynchronizer::operator= const LOW_objectSynchronizer inRightSide  ) 
 

Definition at line 53 of file LOW_objectSynchronizer.cpp.

References LOW_thread_Factory::new_rwlock(), and objectSyncRwlock.


Friends And Related Function Documentation

friend class __synchronizeMethodRead [friend]
 

Definition at line 583 of file LOW_objectSynchronizer.h.

friend class __synchronizeMethodReadWeak [friend]
 

Definition at line 585 of file LOW_objectSynchronizer.h.

friend class __synchronizeMethodWrite [friend]
 

Definition at line 584 of file LOW_objectSynchronizer.h.

friend class __synchronizeMethodWriteWeak [friend]
 

Definition at line 586 of file LOW_objectSynchronizer.h.


Member Data Documentation

LOW_thread_rwlock* LOW_objectSynchronizer::objectSyncRwlock [private]
 

Rwlock used for locking.

Definition at line 594 of file LOW_objectSynchronizer.h.

Referenced by LOW_objectSynchronizer::__synchronizeMethodRead::__synchronizeMethodRead(), LOW_objectSynchronizer::__synchronizeMethodReadWeak::__synchronizeMethodReadWeak(), LOW_objectSynchronizer::__synchronizeMethodWrite::__synchronizeMethodWrite(), LOW_objectSynchronizer::__synchronizeMethodWriteWeak::__synchronizeMethodWriteWeak(), LOW_objectSynchronizer(), operator=(), LOW_objectSynchronizer::__synchronizeMethodRead::~__synchronizeMethodRead(), LOW_objectSynchronizer::__synchronizeMethodReadWeak::~__synchronizeMethodReadWeak(), LOW_objectSynchronizer::__synchronizeMethodWrite::~__synchronizeMethodWrite(), LOW_objectSynchronizer::__synchronizeMethodWriteWeak::~__synchronizeMethodWriteWeak(), and ~LOW_objectSynchronizer().

LOW_platformMiscFactory::threadIdent_t LOW_objectSynchronizer::writeLockHolder [private]
 

Thread id of the one who's holding a write lock.

Definition at line 595 of file LOW_objectSynchronizer.h.

Referenced by LOW_objectSynchronizer::__synchronizeMethodReadWeak::__synchronizeMethodReadWeak(), LOW_objectSynchronizer::__synchronizeMethodWrite::__synchronizeMethodWrite(), LOW_objectSynchronizer::__synchronizeMethodWriteWeak::__synchronizeMethodWriteWeak(), LOW_objectSynchronizer(), LOW_objectSynchronizer::__synchronizeMethodWrite::~__synchronizeMethodWrite(), and LOW_objectSynchronizer::__synchronizeMethodWriteWeak::~__synchronizeMethodWriteWeak().


The documentation for this class was generated from the following files:
Generated on Tue Feb 3 11:31:03 2004 for OneWireLibrary++ by doxygen 1.3.2