Protomatter Software v1.1.7

com.protomatter.util
Class Mutex

java.lang.Object
  |
  +--com.protomatter.util.Mutex

public class Mutex
extends java.lang.Object

A mutex.


Constructor Summary
Mutex()
          Create a new mutex.
 
Method Summary
 void getLock()
          Obtain the lock on the mutex.
 java.lang.Thread getLockingThread()
          Get a reference to the thread that currently has the lock.
 boolean isLocked()
          Determine if this mutex is currently locked by anyone.
 void releaseLock()
          Release the lock on the mutex.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Mutex

public Mutex()
Create a new mutex.
Method Detail

getLock

public void getLock()
Obtain the lock on the mutex. This method blocks, and threads are stacked in the order they call this method.

isLocked

public boolean isLocked()
Determine if this mutex is currently locked by anyone.

getLockingThread

public java.lang.Thread getLockingThread()
Get a reference to the thread that currently has the lock. Returns null if nobody has the lock.

releaseLock

public void releaseLock()
Release the lock on the mutex. Users of this class should be nice about using this method -- don't call it unless you've already called getLock(), since this does not check to make sure the caller is really the lock owner.

Protomatter Software v1.1.7
Copyright 1998-2002 Nate Sammons

Protomatter Software v1.1.7 http://protomatter.sourceforge.net/1.1.7