Package ptolemy.domains.dde.kernel
Class DDEThread
- java.lang.Object
-
- java.lang.Thread
-
- ptolemy.kernel.util.PtolemyThread
-
- ptolemy.actor.process.ProcessThread
-
- ptolemy.domains.dde.kernel.DDEThread
-
- All Implemented Interfaces:
java.lang.Runnable
,Debuggable
public class DDEThread extends ProcessThread
A DDEThread controls an actor according to DDE semantics. The primary purpose of a DDEThread is to control the iteration methods of an executing actor and to maintain the actor's local notion of time according to DDE semantics. A DDEThread has two unique functionalities for accomplishing this goal. First a DDEThread instantiates a TimeKeeper object. A TimeKeeper manages a given actor's local notion of time according to DDE semantics. The second task of a DDEThread is to notify directly connected actors when the actor controlled by the thread is ending execution.- Since:
- Ptolemy II 0.3
- Version:
- $Id$
- Author:
- John S. Davis II
- See Also:
TimeKeeper
- Pt.AcceptedRating:
- Yellow (yuhong)
- Pt.ProposedRating:
- Yellow (davisj)
-
-
Field Summary
-
Fields inherited from class ptolemy.actor.process.ProcessThread
_actor, _director, _manager
-
Fields inherited from class ptolemy.kernel.util.PtolemyThread
_debugging, _debugListeners
-
-
Constructor Summary
Constructors Constructor Description DDEThread(Actor actor, ProcessDirector director)
Construct a thread to be used to execute the iteration methods of a DDEActor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TimeKeeper
getTimeKeeper()
Return the time keeper that keeps time for the actor that this thread controls.void
noticeOfTermination()
Notify output-connected actors that the actor controlled by this thread is ending execution.void
start()
Start this thread and initialize the time keeper to a future time if specified in the director's initial time table.void
wrapup()
End the execution of the actor under the control of this thread.-
Methods inherited from class ptolemy.actor.process.ProcessThread
_actorInitialized, _iterateActor, getActor, run
-
Methods inherited from class ptolemy.kernel.util.PtolemyThread
_debug, _debug, addDebugListener, removeDebugListener
-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, stop, suspend, toString, yield
-
-
-
-
Constructor Detail
-
DDEThread
public DDEThread(Actor actor, ProcessDirector director) throws IllegalActionException
Construct a thread to be used to execute the iteration methods of a DDEActor. This increases the count of active actors in the director.- Parameters:
actor
- The DDEActor that will be executed.director
- The director of this actor.- Throws:
IllegalActionException
- If thrown while create a new TimeKeeper.
-
-
Method Detail
-
getTimeKeeper
public TimeKeeper getTimeKeeper()
Return the time keeper that keeps time for the actor that this thread controls.- Returns:
- The TimeKeeper of the actor that this thread controls.
-
noticeOfTermination
public void noticeOfTermination()
Notify output-connected actors that the actor controlled by this thread is ending execution. Output-connected actors are those that are connected to the actor controlled by this thread via output ports of this thread's actor. Send events with time stamps of PrioritizedTimedQueue.INACTIVE to these "downstream" actors.- See Also:
PrioritizedTimedQueue
-
start
public void start()
Start this thread and initialize the time keeper to a future time if specified in the director's initial time table. Use this method to facilitate any calls to DDEDirector.fireAt() that occur prior to the creation of this thread. If fireAt() was called for time 'T' with respect to the actor that this thread controls, then set the current time of this threads TimeKeeper to time 'T.'NOTE: This method assumes an implementation of fireAt() that would be more appropriately named continueAt().
- Overrides:
start
in classjava.lang.Thread
-
wrapup
public void wrapup() throws IllegalActionException
End the execution of the actor under the control of this thread. Notify all actors connected to this actor that this actor is preparing to cease execution.- Overrides:
wrapup
in classProcessThread
- Throws:
IllegalActionException
- If an error occurs while ending execution of the actor under the control of this thread.
-
-