Guardian Programmer's Guide

Table Of Contents
Managing Time
Guardian Programmer’s Guide 421922-014
18 - 18
Setting and Canceling Timers: Process Time
receive system message -26 (the Process time signal message) in its $RECEIVE file
when the timer expires.
To start the process timer, supply the SIGNALPROCESSTIMEOUT procedure with the
time period in 0.01-second units. You can also supply this procedure with values that
will allow the timer to be identified in the message read from $RECEIVE. The
SIGNALPROCESSTIMEOUT procedure returns a value in the tag parameter for
passing to the CANCELPROCESSTIMEOUT procedure.
CANCELPROCESSTIMEOUT uses this value to distinguish among multiple timers.
The Process time signal message received from $RECEIVE when the timer expires
has the following format:
The following example starts a process timer to expire after 30 seconds of active
processing time. The example uses the parameter-1 parameter to supply an
identifier that will be returned in word 1 of the system message. The
SIGNALPROCESSTIMEOUT procedure returns a value in the tag parameter for
passing to the CANCELPROCESSTIMEOUT procedure, which will use it to identify
this timer.
TIMEOUT^VALUE := 3000D;
PARAMETER^1 := 2;
CALL SIGNALPROCESSTIMEOUT(TIMEOUT^VALUE,
PARAMETER^1,
!parameter^2!,
TAG^1);
Note that parameter-2 is not supplied in this case. The purpose of parameter-2 is
the same as parameter-1, but parameter-2 allows you to use a 32-bit tag instead
of a 16-bit tag. If used, the value of parameter-2 is returned in word 2 of the system
message.
To cancel the timer set above, supply the CANCELPROCESSTIMEOUT procedure
with the tag value that was returned by the SIGNALPROCESSTIMEOUT procedure:
CALL CANCELPROCESSTIMEOUT(TAG^1);
For details on how to read system messages from the $RECEIVE file, see Section 6,
Communicating With Processes. You can identify the timer by checking word 1 of the
Process time signal message; in this case, its value will be equal to PARAMETER^1.
Format of system message -26 (Process time signal message):
sysmsg[0] = -26
sysmsg[1] = First parameter supplied by
SIGNALPROCESSTIMEOUT;
default value 0
sysmsg[2] FOR 2 = Second parameter supplied by
SIGNALPROCESSTIMEOUT;
default value 0D