Example:
FOR QUIT:$D(^CTRL(1)) HANG 30
This FOR loop repeatedly tests for the existence of ^CTRL(1), and terminates when that global variable exists. Otherwise the routine HANGs for 30 seconds and tests again.
Example:
SET t=1 F Q:$D(^CTRL(1)) H t I t<30 S t=t+1
This is similar to the previous example, except that it uses an adaptive time that lengthens from 1 second to a limit of 30 seconds if the routine stays in the loop.