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

Lock Class Reference

Implementation of locking. More...

#include <lock.h>

List of all members.

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.


Detailed Description

Implementation of locking.

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).

Author:
Marek Przeczek, Petr Luner

Definition at line 54 of file lock.h.


Constructor & Destructor Documentation

Lock::Lock const String   name,
JVMPI_Interface *    jvmpi = NULL
 

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.

Parameters:
name  name of mutex (used on WIN32 only)
jvmpi  pointer to JVMPI interface
See also:
WIN32 API, UNIX API, String

Definition at line 38 of file lock.cpp.


Member Function Documentation

void Lock::release  
 

Unlocking.

This method releases locked mutex so it can be then used by someone else.

See also:
wait()

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().

void Lock::wait  
 

Locking.

This method waits on the mutex till it is used by someone else.

See also:
release()

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().


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