*DECK NETWAIT USETEXT AIPDEF USETEXT NP$MODE *IF DEF,XFR USETEXT NX$ACBF USETEXT NX$ACBX *ENDIF USETEXT NP$NWL USETEXT NP$STAT PROC NETWAIT((TIME),(FLAG)); *IF DEF,IMS # *1DC NETWAIT * * 1. PROC NAME AUTHOR DATE * NETWAIT S. KRULEVITCH 78/11/10 * * 2. FUNCTIONAL DESCRIPTION * THIS ROUTINE BUILDS A WAIT-REQUEST AND SENDS IT TO NIP WHERE * CONTROL WILL BE TAKEN AWAY FROM THE APPLICATION UNTIL A DATA * OR SUPERVISORY BLOCK IS AVAILABLE FOR UNTIL THE SPECIFIED * TIME-INTERVAL HAS BEEN EXCEEDED. * * 3. METHOD USED * PARALLEL MODE, IF ON, IS TEMPORARILY SUSPENDED UNTIL THE * NETWAIT REQUEST IS SENT AND COMPLETED BY NIP. IF AIP HAS A * SUPERVISORY MESSAGE IN AIP"S SMB(SUPERVISORY MESSAGE BUFFER) * OR THERE IS DATA QUEUED FOR THE APPLICATION WITHIN NIP, * AND THE NETWAIT IS NOT FORCED (FLAG = FALSE), THEN CONTROL * IS RETURNED TO THE USER WITHOUT SENDING THE NWL TO NIP. * S AND I BITS IN THE NSUP WORD IS UPDATED. * * 4. ENTRY CONDITIONS * TIME - MAXIMUM TIME DURATION OF WAIT, IN SECONDS * FLAG - INDICATES WHETHER TO WAIT FOR TIME TO ELAPSE (=TRUE) * OR TO WAIT UNTIL INPUT IS AVAILABLE (=FALSE) * * 5. EXIT CONDITONS * RETURNS NORMAL CONTROL TO APPLICATION * S$FLAG = TRUE IF THERE IS A SUPERVISORY MESSAGE IN AIP"S * I$FLAG - TRUE IF INPUT DATA QUEUED IN NIP * S$FLAG - TRUE IF A NON-EMPTY SMB OR SM QUEUED IN NIP * SMB AND NETWAIT IS NOT FORCED. * * 6. COMDECKS CALLED AND SYMPL TEXTS USED. * AIPDEF NP$CRT NP$MODE NP$NWL * NP$STAT * * 7. ROUTINES CALLED * NP$ERR - PRINTS ERROR MESSAGES AND STOPS * NP$OSIF - SENDS OS REQUEST * NP$SEND - SENDS WORKLIST TO NIP * NP$SN - INCREMENTS STATISTICS COUNTER * NP$UCV - UPDATE CONTROL VARIABLES * NP$USI - UPDATE S,I AND D BITS IN THE NSUP WORD * * 8. DAYFILE MESSAGES * NETWORK APPLICATION ABORTED, RC = 33. * NETWAIT: REQUEST INVALID BEFORE NETON. * * NETWORK APPLICATION ABORTED, RC = 44. * NETWAIT: PREVIOUS REQUEST INCOMPLETE. * * # *ENDIF BEGIN *CALL NP$CRT # # # FORMAL PARAMETERS: # # # ITEM TIME U; # MAXIMUM NETWAIT TIME # ITEM FLAG B; #INPUT AVAILABLE/TIMER EXPIRED# ITEM WAIT$FLAG B; # WAIT$FLAG = ID$FLAG IF # # WAITDEL FLAG IS FALSE # # ELSE WAIT$FLAG = WD$FLAG # # # # EXTERNAL ROUTINES: # # # XREF BEGIN PROC NP$ERR; #ERROR PROCESSING # PROC NP$OSIF; #ISSUE OS REQUEST # PROC NP$RCL; # ISSUE RECALL # PROC NP$SEND; #SEND NWL TO NIP VIA SSCALL # *IF DEF,STAT PROC NP$SN; #INCREMENTS STATISTICS COUNTER# *ENDIF PROC NP$UCV; # UPDATE CONTROL VARIABLES # PROC NP$USI; # UPDATE S AND I BITS IN NSUP # *IF,DEF,XFR PROC NP$RTIM; # GET CURRENT TIME # PROC NETXFRC; # CONTINUING TRANSFERING FILES # *ENDIF END #XREFS# # # ITEM *IF,DEF,XFR WAITIME , # WAIT TIL THIS TIME # *ENDIF PAR B=FALSE; #FLAG FOR PARALLEL MODE # #**********************************************************************# # NETWAIT EXECUTION BEGINS HERE # *IF DEF,DEBUG *ENDIF IF NOT ACCEPTED THEN NP$ERR("33"); # REQUEST INVALID BEFORE NETON. # IF DEFER$PRO THEN NP$ERR("44"); # PREVIOUS REQUEST INCOMPLETE. # *IF DEF,STAT # UPDATE STATISTICS IF STAT IS DEFINED # NP$SN(TYPE"WAIT"); #INCREMENT COUNTER # *ENDIF # *IF,DEF,XFR IF THERE ARE FILES BEING TRANSFERED OUSTANDING AND S BIT NOT ON, CONTINUE TRANSFERING FILE UNTIL NO MORE FILE TO BE TRANSFERED OR NO MORE THING TO DO, OR TIME TO WAIT HAS BEEN ESLAPSED. *ENDIF NO WAIT IF IT IS NOT A FORCED NETWAIT AND THERE ARE MESSAGES AVAILABLE EITHER IN THE SMB OR QUEUED WITHIN NIP, OTHERWISE THE APPLICATION WILL GO INTO RECALL EITHER UNTIL INPUT BECOMES AVAILABLE OR THE TIME PERIOD SPECIFIED IN NETWAIT CALL EXPIRES. # *IF,DEF,XFR IF NUMFILEXFR NQ 0 # NEED TO DO FILE TRANSFER # AND SD$FLAG EQ 0 # S BIT IS NOT ON # THEN BEGIN NP$RTIM(TIME$WORD) ; # GET CURRENT TIME # WAITIME = ( TIME$SEC[0] + TIME);# WAIT TIL THIS TIME IN SECOND # # FILEXFR OUTSTANDING # XFR$COM = FALSE; # CLEAR XFR COMPLETION FLAG # NETXFRC; # CONTINUING FILE TRANSFER # NP$RTIM(TIME$WORD) ; # GET NEW CURRENT TIME # TIME = WAITIME - TIME$SEC[0] ; # TIME LEFT FOR WAITING # IF XFR$COM # IF FILE XFR COMPLETED # THEN BEGIN XFR$COM = FALSE; # RESET FLAG # IF XFR$QB[0] # IF CALLED THROUGH NETWTQ # THEN BEGIN XFR$COM2[0] = TRUE; # SUSPEND SECOND NETWAIT # END GOTO ENDWAIT; # SKIP NETWAIT # END END *ENDIF IF WAITDEL # IF NETFUNC WAS ISSUED # THEN BEGIN WAIT$FLAG = NOT WD$FLAG; # CHECK FOR WD$FLAG IN DATA # END ELSE BEGIN # REGULAR PROCESSING # WAIT$FLAG = ID$FLAG EQ 0; # OTHERWISE CHECK FOR ID$FLAG # END IF (TIME GR 0 ) AND ( (FLAG ) OR ( (HEAD EQ FOOT ) AND (GMBHEAD EQ GMBFOOT) AND (WAIT$FLAG ) AND (SD$FLAG EQ 0 ) ) ) THEN BEGIN # FORCED NETWAIT AND NO DATA AVAILABLE # NWL[NEXT] = 0; # FORMAT NETWAIT NWL ENTRY # NWL$ID[NEXT] = AWLID; BS = OPABHSIZ; # NWL ENTRY SIZE # NWL$OP[NEXT] = OP$WAIT; NWL[NEXT + 1] = 0; # CLEAR NEXT ENTRY # IF TIME GR 4095 THEN WT$TIME[NEXT+1] = 4095; ELSE WT$TIME[NEXT+1] = TIME; # NETWAIT TIME # WT$FLAG[NEXT+1] = FLAG; # WHETHER A FORCED NETWAIT # WT$WD[NEXT + 1] = WAITDEL; # SET WD FLAG IN WORKLIST # # IF NETFUNC NOT ISSUED BEFORE # # WAITDEL IS 0 HENCE WT$WD IS # # 0 # NP$UCV; # UPDATE CONTROL VARIABLES # PAR = PARALLEL; PARALLEL = FALSE; # ALWAYS GIVE UP CPU ON A WAIT # NP$SEND; # SEND NWL TO NIP # PARALLEL = PAR; # RESTORE PARALLEL FLAG # END ELSE IF SD$FLAG[0] EQ 0 AND HEAD EQ FOOT THEN # PUT APP IN SHORT RECALL IF NO SUP MSG # NP$RCL(0); # UPDATE THE S AND I BITS IN THE NSUP WORD # NP$USI; ENDWAIT: RETURN; END #NETWAIT# TERM