#include <lock.h>
Public Methods | |
Lock (const String &name, JVMPI_Interface *jvmpi=NULL) | |
Constructor. More... | |
~Lock () | |
Destructor. It destroys the mutex. | |
void | wait () |
Locking. More... | |
void | release () |
Unlocking. More... | |
Private Attributes | |
JVMPI_RawMonitor | _rm |
raw monitor object. |
This class implements OS dependent 0/1 locks. It uses mutexes for it. This implementation can be replaced by JVMPI raw monitors. They seem to be implemented using OS dependent mutexes, too (see Java Developer Connection at java.sun.com). But raw monitors are unimplemented in LinuxOS (JDK 1.3.0), so the goal is to make useful "independent" class which can replace JVMPI raw monitors. Place of use: somewhere we need locking of profiler data structures.
Note: raw monitors have properties the "normal" mutexes don't have (eg. we cannot trace our own locks now).
Definition at line 54 of file lock.h.
|
Constructor. This constructor creates mutex using API call. No checking of returned value is done. If the mutex with given 'name' doesn't exist, it is created; if it exists, it is used. If the 'name' is equal to "", no-name mutex is created.
|
|
Unlocking. This method releases locked mutex so it can be then used by someone else.
Definition at line 74 of file lock.cpp. Referenced by Prof::disableGC(), Prof::enableGC(), Prof::event_gcFinish(), Prof::event_jvmShutDown(), Synchronized::release(), Prof::resumeVM(), Prof::runGC(), and Prof::shutdown().
|
|
Locking. This method waits on the mutex till it is used by someone else.
Definition at line 61 of file lock.cpp. Referenced by Prof::communThreadRoutine(), Prof::disableGC(), Prof::enableGC(), Synchronized::enter(), Prof::event_gcStart(), Prof::event_jvmShutDown(), Prof::runGC(), and Prof::suspendVM().
|