Timers are used either to evaluate an expression periodically or after a given delay.
Timers are basic property set based objects with type definition, data constructor and instance:
object Timer ::= Timer [Property];
Timer properties = PropertySet properties;
instance PropertySetBasedObject Timer where
{
};
They are periodic if there is a period property and one-shot if there is an interval property;
in both cases the units are milliseconds. When the interval or period expires, if there is a proc property
(also known as a callback) it is invoked,
otherwise a TimerEvent is raised for the store containing the timer. The type signature for the optional proc
property is:
(Timer -> Void)
The purpose of passing a reference to the timer is to allow access to other timer properties within callback.
Finally, one-shot timers are destroyed immediately after the timer event or callback.
monitorTimer is a built-in method designed for a standard rule to monitor a data store containing timer objects.
Its condition includes patterns for
StartEvent CreateObjectEvent DestroyObjectEvent UpdatePropertyEvent StopEvent
The clock example illustrates the use of a periodic timer.
Last update: 11 October, 2005