ptolemy.actor.process
Class NotifyThread

java.lang.Object
  extended byjava.lang.Thread
      extended byptolemy.actor.process.NotifyThread
All Implemented Interfaces:
java.lang.Runnable

public class NotifyThread
extends java.lang.Thread

Helper thread for calling notifyAll() on a single lock or a LinkedList of locks. Since this is a new thread without any locks, calling notifyAll from this thread reduces the possibility of deadlocks.

To use this to wake up any threads waiting on a lock, create a new instance of this class with a LinkedList of lock objects (or single lock) to call notifyAll() on.

Since:
Ptolemy II 0.2
Version:
$Id: NotifyThread.java,v 1.27 2004/04/13 03:11:07 cxh Exp $
Author:
Neil Smyth, Mudit Goel
Accepted Rating:
Yellow (mudit)
Proposed Rating:
Green (mudit)

Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
NotifyThread(java.util.LinkedList locks)
          Construct a thread to be used call notifyAll() on a set of locks.
NotifyThread(java.lang.Object lock)
          Construct a thread to be used call notifyAll() on a set of locks.
 
Method Summary
 void run()
          Call NotifyAll() on the lock object (or objects) passed to this class in its constructor.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NotifyThread

public NotifyThread(java.util.LinkedList locks)
Construct a thread to be used call notifyAll() on a set of locks.

Parameters:
locks - The set of locks to call notifyAll() on.

NotifyThread

public NotifyThread(java.lang.Object lock)
Construct a thread to be used call notifyAll() on a set of locks.

Parameters:
lock - The lock to call notifyAll() on.
Method Detail

run

public void run()
Call NotifyAll() on the lock object (or objects) passed to this class in its constructor.