Guardian Procedure Calls Reference Manual
Condition Code Settings
indicates that the new-time-limit parameter is omitted or is specified as a negative value. The
state of process loop timing and the setting of the process' loop timer are unchanged.
< (CCL)
indicates that the new-time-limit value is set into the process' loop timer and that loop timing is
enabled.
= (CCE)
is not returned from SETLOOPTIMER.> (CCG)
Considerations
• Process processor time
Using SETLOOPTIMER to measure process processor time is not recommended. Use the
MYPROCESSTIME procedure for this purpose.
• Timed asynchronous interrupts
SETLOOPTIMER is not practical for generating timed asynchronous interrupts for most users.
• Process loop timeout in system code
If a process loop-timer expires in protected code, the trap (for a Guardian TNS process) or
signal (for an OSS process or native process) is delayed until control enters unprotected code.
• Detection of process looping
To detect whether it is looping, a process can call SETLOOPTIMER (resetting the time limit) at
a given point each time through its main execution loop. If the process fails to finish executing
its main loop, SETLOOPTIMER is not called and the time limit is not reset. Consequently, the
time limit is reached, and a trap or signal occurs. (When the trap handler or signal handler
completes execution, the process resumes its normal instruction path.)
For example, a process' main execution loop can be written as follows:
For example, a process’s main execution loop can be written as follows:
-->
| |
| start:
| CALL SETLOOPTIMER ( 1000 );
| IF < THEN ... ;
| | .
| | . ! enable loop timing.
| | . ! Time-limit value is 10 seconds.
| | .
| CALL WRITEREAD ( termfnum ,... );
| | .
| | . ! process executes when terminal input is made.
| | . ! Loop-timer value is not decremented while
| | . ! process is suspended waiting for I/O.
| |
| terminal input is processed
OSS Considerations
When the process loop-timer expires for an OSS process, a SIGTIMEOUT signal is generated.
Example
CALL SETLOOPTIMER ( NEW^TIME );
1316 Guardian Procedure Calls (S)