*DECK SSSWNR
USETEXT TEXTSS
PROC SSSWNR;
# TITLE SSSWNR - WAIT NEW REQUEST. #
BEGIN # SSSWNR #
#
** SSSWNR - WAIT NEW REQUEST.
*
* S. H. FISCHER. 81/08/27.
* D. K. ENDO 82/04/22.
* C. J. BRION 83/06/06.
*
* THIS ROUTINE IS CALLED WHEN NO WORK IS AVAILABLE.
* IT DETERMINES IF THE PROGRAM SHOULD ROLLOUT (NETWAIT)
* OR JUST GO INTO PERIODIC RECALL.
*
* PROC SSSWNR
*
* ENTRY 1. NONE.
*
* EXIT 1. NONE.
*
*
#
#
**** PROC SSSWNR XREF LIST.
#
XREF
BEGIN
PROC NETWAIT; # REQUESTS NAM TO ROLLOUT #
PROC RECALL; # PLACE PROGRAM IN RECALL STATUS #
PROC RTIME; # GET REAL TIME FROM SYSTEM #
PROC SSTDFL; # DECREASE FIELD LENGTH #
END
#
****
#
ITEM FOUND B; # FLAG SET IF A COMPLETE BIT IS NOT SET #
ITEM I; # LOOP INDUCTION VARIABLE #
ITEM WAIT; # COMPUTED MAXIMUM ROLLOUT TIME #
ITEM TEMPI U; # TEMPORARY UNSIGNED INTEGER FOR TIMESTAMP#
ARRAY TT$SWAPW[00:00] S(1);
BEGIN
ITEM TT$TSEC U(00,00,24); # REAL TIME IN SECONDS #
ITEM TT$MILLI U(00,24,36); # REAL TIME IN MILLISECONDS #
ITEM TT$TWORD U(00,00,60);
END
#
THIS BASED ARRAY POINTS TO THE WORD CONTAINING THE COMPLETE BIT
THAT IS TO BE CHECKED.
#
BASED ARRAY COMP$WORD [00:00] S(1);
BEGIN
ITEM CW$WORD U(00,00,60);
END
CONTROL EJECT;
# #
# SSSWNR CODE BEGINS HERE #
# #
#
* IF THE NEXT FIRE TIME IS LESS THAN THE MINIMUM ROLLOUT TIME PLUS
* THE CURRENT TIME, THEN GO INTO RECALL, ELSE IF THE OVERLAY
* REQUEST COUNTER IS NONE ZERO THEN GO INTO RECALL, ELSE USING THE
* ROLLOUT TABLE CHECK IF THERE ARE ANY OUTSTANDING EXTERVAL REQUESTS
* IF THERE IS, THEN GO INTO RECALL, ELSE DECREASE THE FIELD LENGTH
* TO A MINIMUM, CALCULATE THE ROLLOUT
* PERIOD BY SUBTRACTING THE NEXT FIRE TIME FROM THE CURRENT TIME AND
* CALL NAM TO ROLL US OUT.
*
#
$BEGIN # INCREMENT COUNT FOR STATISTICS #
SVT$VAL[SVL"WNR"] = SVT$VAL[SVL"WNR"] + 1;
$END
IF CTM$FTIME[0] LS (CTM$RTSEC[0] + MRT)
THEN
BEGIN
RECALL(0);
END
ELSE IF ORC NQ 0
THEN
BEGIN
RECALL(0);
END
ELSE
BEGIN
FOUND = FALSE;
FOR I=1 STEP 1 WHILE NOT FOUND AND
I LQ RT$EC[0]
DO
BEGIN
P<COMP$WORD> = RT$WADD[I];
IF B<RT$BPOS[I],1>CW$WORD[0] EQ 0
THEN
BEGIN
FOUND = TRUE;
END
END
IF FOUND
THEN
BEGIN
RECALL(0);
END
ELSE
BEGIN
SSTDFL;
WAIT = CTM$FTIME[0] - CTM$RTSEC[0];
#
* IF FORCED ROLL OF PROGRAM CONDITION EXISTS, ISSUE FORCED NETWAIT
* CALL FOR MFRT$ PERIOD OF TIME. OTHERWISE ISSUE NORMAL NETWAIT CALL
* THAT WILL CAUSE ROLLOUT ONLY IF INPUT AVAILABLE NOT INDICATED BY
* THE AIP NSUP WORD.
#
IF PGM$FOROLL[0]
THEN
BEGIN
WAIT = MFRT$;
PGM$FOROLL[0] = FALSE;
NETWAIT(WAIT,TRUE); # FORCED ROLLOUT #
END
ELSE
BEGIN
RTIME(TT$SWAPW); # GET REAL TIME #
IF TT$TSEC[0] GQ SS$TSEC[0]
THEN
BEGIN
TEMPI = TT$TSEC[0]*1000 + TT$MILLI[0] -
SS$TSEC[0]*1000 - SS$TMILLI[0];
END
ELSE
BEGIN # SECONDS COUNTER OVERFLOWED #
TEMPI = SWAP$DELAY + 1;
END
IF TEMPI GR SWAP$DELAY # IF GREATER THAN DELAY TIME #
THEN
BEGIN
SS$TWORD[0] = 0; # CLEAR TIMESTAMP #
NETWAIT(WAIT,FALSE); # ROLLOUT ONLY IF NO INPUT #
IF NOT (NSUP$DAIN OR NSUP$SMIN)
THEN
BEGIN # FREE CPU IF NO MSGS PENDING #
RECALL(0);
END
END
END
END
END
RETURN; # **** RETURN **** #
END # SSSWNR #
TERM