Class Sleep

  • All Implemented Interfaces:
    java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable
    Direct Known Subclasses:
    SleepFireTwice

    public class Sleep
    extends Transformer

    On each firing, read at most one token from each input channel, sleep by the specified amount of real time, and then produce the same input tokens on the respective output channels. This actor calls Thread.sleep() in the fire() method, so the thread that calls fire() will be suspended. If fire() is called multiple times in one iteration, sleep is only called the first time. If the width of the output port is less than that of the input port, the tokens in the extra channels are lost.

    The effect of this actor is different in different domains. In domains where all actors are iterated from within a single director thread (like SDF and DE), then multiple instances of this actor will result in cumulative time delays. That is, the time taken by an iteration of the model will be greater than the sum of the sleep times of all the instances. In domains where actors execute in their own thread (like PN and CSP), only the execution of the individual actor is slowed. Note that another way to slow down the execution of a model while running inside vergil is to turn on animation.

    Since:
    Ptolemy II 1.0
    Version:
    $Id$
    Author:
    Jie Liu, Christopher Hylands, Edward A. Lee
    Pt.AcceptedRating:
    Red (cxh) Review _wasSleepCalledInFireYet, esp locking
    Pt.ProposedRating:
    Green (eal)