GELOOP - protect against infinite loops.

Usage:

mme     geloop

Where:

Q register
contains the number of seconds that the program is allowed to execute before a time-out occurs. If this value is -1 (decimal), the time-out will only occur when the program reaches the time allowed by the $LIMITS JCL statement for the activity.
Word 27 (octal) of the Slave Program Prefix
should contain the address of a routine that should be invoked if the GELOOP time-out occurs. This address is given in the bottom half of the word. If this address is zero, the program will simply abort if a time-out occurs.

Description:

MME GELOOP lets a program protect itself against infinite loops by setting up artificial time-outs that are triggered before your program times out for the last out (because it has exceeded the time specified on the activity's $LIMITS statement). Typically, you issue a MME GELOOP before executing code that might get into an infinite loop; in this way, you can put a time limit on how long that code will be allowed to execute.

If the code does get into an infinite loop, it will eventually time out, giving the program the chance to recover (and to investigate the cause of the loop). If there is no loop, the program can issue another MME GELOOP at the end of the suspicious code, removing the self-imposed time limit.

If a time-out occurs, the program will regain control at the return address specified in the lower half of word 27 (octal) in the slave program prefix. When execution begins at this return address, the program registers will have the values they had when the time-out occurred. If you want to resume execution of the timed-out code, you must save and restore these register values; it is not done automatically.

If the time-out occurs during execution of a multi-word instruction, and if a return address is specified, the mid-instruction interrupt bit of the Indicator register (bit 30) will be set to 1 and the pointer and length register will contain valid information for the interrupted instruction. If you do not resume the multi-word instruction immediately, you should save the pointer and length register and turn off the Indicator's mid-instruction bit. All instructions between the return address and the end of saving the registers must be inhibited.

MME GELOOP may not be used in a courtesy call.

Copyright © 2000, Thinkage Ltd.