Class DEThreadActor

  • All Implemented Interfaces:
    java.lang.Cloneable, java.lang.Runnable, Actor, Executable, FiringsRecordable, Initializable, SequenceActor, TimedActor, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

    public abstract class DEThreadActor
    extends DEActor
    implements java.lang.Runnable
    A base class for threaded DE domain actors.

    NOTE: This actor is very preliminary. It is not developed and maintained for a long time. We do not recommend using it. To try multiple threads under DE semantics, use DDE domain, which is another experimental domain.

    This actor, upon its initialization, will start another thread. The thread communicate with the DEDirector thread by placing events into the DEEventQueue asynchronously.

    Subclass of this class should implement the run() method. The subclass is executed in an event driven way. More precisely, the implementation of the run() method should call waitForNewInputs() after processing all current events. The calls are blocked until the next time fire() is called. Recall that the Director (after putting events into the receiver of the input ports) will call fire() on the actor. NOTE: The synchronization mechanism is implemented in DECQEventQueue to ensure the correct multi-threading behaviour.

    This implementation does not change the semantics of DEReceiver, but still supports an asynchronous message passing type of concurrency.

    Since:
    Ptolemy II 0.2
    Version:
    $Id$
    Author:
    Lukito Muliadi
    See Also:
    DEActor
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (lmuliadi)
    • Method Detail

      • run

        public abstract void run()
        Implement this method to define the job of the threaded actor.
        Specified by:
        run in interface java.lang.Runnable
      • waitForNewInputs

        public void waitForNewInputs()
        Clear input ports then wait until input events arrive.
      • waitForNewInputs

        public void waitForNewInputs​(IOPort[] ports)
                              throws IllegalActionException
        Wait for new inputs on the specified array of ports.
        Parameters:
        ports - The array of ports whose inputs we're interested in.
        Throws:
        IllegalActionException - If the specified array of ports is not all input ports.