#include <synchronized.h>
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. |
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.
Definition at line 51 of file synchronized.h.
|
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).
Definition at line 73 of file synchronized.h. |
|
Destructor. It releases entered lock if it wasn't done before.
Definition at line 85 of file synchronized.h. |
|
Entering lock. This method enters released lock. Note: entering of already entered lock can make deathlocking !!!
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().
|
|
Releasing lock. This method releases entered lock. Releasing of released lock does nothing.
Definition at line 92 of file synchronized.h. Referenced by Sampling::main(), and ~Synchronized().
|