
ContentionAlarm |
ptolemy.domains.csp.demo.BusContention.ContentionAlarm |
A ContentionAlarm is a CSP actor that creates an output only after
timed deadlock has been reached by all other CSP actors in the
containing composite actor. A ContentionAlarm has one input and
one output port as well as three "informal" states. During the
fire() method, the actor is enabled to cycle through each of the
three states.
In state one, the ContentionAlarm attempts to receive a token through
its input port. Once a token has been received, the actor enters state
two and calls the _waitForDeadlock() method that it inherits from
CSPActor. This method means that the actor becomes time delayed and
will not continue until all other actors in the composite actor are
either blocked or time delayed. Once _waitForDeadlock() returns, the
actor enters state three and sends a token through its output port.
A useful application of ContentionAlarm is to notify other actors
if there are multiple contenders for a given resource at a given
time. Because of the semantics of _waitForDeadlock(), ContentionAlarm
will not "wake up" until all contenders have attempted to access a
particular resource.
In addition to the time delay oriented semantics of ContentionAlarm,
it can also notify an ExecEventListener as this actor jumps between
its three states. Such notification is enabled by adding an
ExecEventListener to this actor's listener list via the addListeners()
method. Listeners can be removed via the removeListeners() method.
ExecEventListeners are currently implemented to serve as conduits
between Ptolemy II and the Diva graphical user interface.
Author(s): John S. Davis II
Version:$Id: ContentionAlarm.doc.html,v 1.1 2006/02/22 18:40:26 mangal Exp $
Pt.Proposed Rating:Red (davisj)
Pt.Accepted Rating:Red (cxh)
input
The input port. The type of this port is BaseType.GENERAL.
output
The output port. The type of this port is BaseType.GENERAL.