*DECK IPUWAIT
USETEXT TEXTIPL
PROC IPUWAIT (SECONDS);
*CALL COPYRITE CDCNET - COPYRIGHT CONTROL DATA. 1992.
# TITLE IPUWAIT - APPLICATION WAIT TIMER #
BEGIN # IPUWAIT #
#
**** IPUWAIT APPLICATION WAIT TIMER.
*
* THIS PROCEDURE CALLS CAUSES THE APPLICATION TO SUSPEND FOR THE
* SPECIIED TIME.
*
* PROC IPUWAIT
*
* ENTRY SECONDS = INTEGER VALUE OF SECONDS TO WAIT
*
* EXIT TIME ELAPSED.
*
* METHOD OBTAIN THE CURRENT TIME. CALL *NETWAIT* FOR THE
* SPECIFIED TIME. CHECK NAM FOR INPUT. THE *NETWAIT*
* TIMER WILL EXPIRE EARLY IF NAM HAS DATA FOR THE
* APPLICATION. IF THIS WAS THE CASE, CONTINUE CALLING
* *IPINITH* TO PROCESS ANY OTHER POSSIBLE INPUT UNTIL THE
* TIME HAS EXPIRED.
#
#
**** PROC IPUWAIT - XREF LIST
#
XREF
BEGIN
PROC IPINITH; # NAM INPUT TRAFFIC HANDLER #
PROC NETWAIT; # SUSPEND NAM APPLICATION #
PROC RTIME; # REAL TIME CLOCK #
END
#
**
#
ITEM SECONDS I; # SECONDS TO WAIT #
ITEM INDEX I; # LOOP COUNTER #
ITEM LOOP I; # LOOP COUNTER #
ITEM WAITLOOP I; # WAIT LOOP COUNTER #
CONTROL EJECT;
#
**** START MAIN PROCEDURE
#
RTIME (BWT$TIME); # CURRENT TIME #
BWT$EXPIRE [0] = BWT$SECONDS [0] + SECONDS;
NETWAIT (SECONDS, 0); # CALL NETWAIT FOR INITIAL WAIT #
BLOCK = TRUE;
IPINITH; # NAM INPUT TRAFFIC HANDLER #
FOR INDEX = 0
DO
BEGIN # LOOP UNTIL TIMER EXPIRES #
RTIME (BWT$TIME);
IF (BWT$SECONDS [0] GQ BWT$EXPIRE [0])
THEN
BEGIN # TIMER EXPIRED #
RETURN;
END
WAITLOOP = (BWT$EXPIRE [0] - BWT$SECONDS [0]) / 2 + 1;
FOR LOOP = 1 STEP 1 UNTIL WAITLOOP
DO
BEGIN
IPINITH; # NAM INPUT TRAFFIC HANDLER #
END
END # LOOP UNTIL TIMER EXPIRES #
END # IPUWAIT #
TERM