This function sets one or more asynchronous timers. As each interval expires, a record is written to a stack to notify your IMOD.
Form 1:
id = $TIMER(SET,sec,stknum,[rec],[imodid])
Form 2:
id = $TIMER(CLEAR,id)
Parameters
Establishes a new timer interval without affecting existing intervals.
Clears an existing interval.
Unique ID assigned by timing facility. If you are canceling an existing interval, specify this ID.
Number of seconds in the interval.
Number of the stack posted when the interval expires.
1 to 256-byte argument that is placed on the stack when the interval expires. The default is TIME_EXPIRED.
IMOD that owns the stack that is being posted when the interval expires.
When an interval expires, the text in rec (or TIME_EXPIRED) is written to the stack, followed by a blank and the interval ID (id) returned by the SET argument.
ARG n MISSING OR INVALID
TIMER IS NOT AVAILABLE
SYSTEM SHUTDOWN IN EFFECT
STORAGE EXHAUSTED
Example
/* Set two timers */ id1 = $timer('set',10,1,'INTERVAL_1') id2 = $timer('set',60,1,'INTERVAL_2') .../* start other processes */ x = wait(0,1,2) /* wait on multiple events) if x = 1 then do rec = pull(1) parse var rec string id . select when string = 'INTERVAL_1 then call expire_1 when string = 'INTERVAL_2 then call expire_2 otherwise signal timer_error end end
Copyright © 2014 CA Technologies.
All rights reserved.
|
|