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

Synchronized Class Reference

Implementation of easy-to-use synchronization. More...

#include <synchronized.h>

List of all members.

Public Methods

 Synchronized (Lock &lock, int entr=1)
 Constructor. More...

 ~Synchronized ()
 Destructor. More...

void release ()
 Releasing lock. More...

void enter ()
 Entering lock. More...


Private Attributes

Lock_lock
 reference to Lock instance ("independent" mutex implementation).

int _released
 locked/unlocked.


Detailed Description

Implementation of easy-to-use synchronization.

This class gave its name after JTCSynchronized class used in JTC (OOC JavaThreads for C++) library, but it is much, much easier ;-) It uses Lock class internally. Well, you can use Lock class directly, but it is not recommended. This class brings the same functionality without being worry about unlocking at all.

See also:
Lock
Author:
Marek Przeczek

Definition at line 51 of file synchronized.h.


Constructor & Destructor Documentation

Synchronized::Synchronized Lock   lock,
int    entr = 1
[inline]
 

Constructor.

It takes a reference to Lock class instance and locks the lock by calling enter() method. The second parameter specifies if the lock shall be entered automatically while construction (default) or not (so, lock is not entered and must be entered by calling enter() method later - this case is not usual and should not be used too much).

Parameters:
lock  reference to Lock class instance
enter  1 = enter the lock; 0 = don't do that
See also:
Lock, enter()

Definition at line 73 of file synchronized.h.

Synchronized::~Synchronized   [inline]
 

Destructor.

It releases entered lock if it wasn't done before.

See also:
release()

Definition at line 85 of file synchronized.h.


Member Function Documentation

void Synchronized::enter   [inline]
 

Entering lock.

This method enters released lock. Note: entering of already entered lock can make deathlocking !!!

See also:
release()

Definition at line 103 of file synchronized.h.

Referenced by Synchronized(), Prof::event_classLoad(), Prof::event_objectAlloc(), Prof::event_threadStart(), Prof::getData(), and Prof::getInfo().

void Synchronized::release   [inline]
 

Releasing lock.

This method releases entered lock. Releasing of released lock does nothing.

See also:
enter()

Definition at line 92 of file synchronized.h.

Referenced by Sampling::main(), and ~Synchronized().


The documentation for this class was generated from the following file:
Generated on Mon Jan 28 14:53:30 2002 for Java Profiler Dynamic Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001