nl.tudelft.simulation.language.concurrent
Class Monitor

java.lang.Object
  extended by nl.tudelft.simulation.language.concurrent.Monitor

public final class Monitor
extends Object

In the Java programming language there is a lock associated with every object. The language does not provide a way to perform separate lock and unlock operations; instead, they are implicitly performed by high-level constructs that always arrange to pair such operations correctly. This Monitor class, however, provides separate monitorenter and monitorexit instructions that implement the lock and unlock operations.)

(c) copyright 2002-2005 Delft University of Technology , the Netherlands.

See for project information www.simulation.tudelft.nl/language
License of use: Lesser General Public License (LGPL) , no warranty

Since:
1.3
Version:
$Revision: 1.1 $ $Date: 2007/01/06 13:25:55 $
Author:
Peter Jacobs

Method Summary
static void lock(Object object)
          locks an object for the current thread
static void lock(Object object, Thread requestor)
          locks an object for the given requestor.
static void unlock(Object object)
          unlocks an object locked by the current Thread
static void unlock(Object object, Thread owner)
          unlocks an object locked by owner.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

lock

public static void lock(Object object)
locks an object for the current thread

Parameters:
object - the object to lock

lock

public static void lock(Object object,
                        Thread requestor)
locks an object for the given requestor.

Parameters:
object - the object to lock.
requestor - the requesting thread.

unlock

public static void unlock(Object object)
unlocks an object locked by the current Thread

Parameters:
object - the object to unlock

unlock

public static void unlock(Object object,
                          Thread owner)
unlocks an object locked by owner.

Parameters:
object - the object to unlock.
owner - the owning thread.


Copyright © 2002-2011 Delft University of Technology, the Netherlands. All Rights Reserved.