GDSX Manual
Design and Development
Extended General Device Support (GDSX) Manual–134303
2-94
The LINE^HANDLER Procedure
STOP^LINE does the following:
Initializes the local variable lineno from the task’s TCB state word. This is the line for
which the terminating task was the handler.
1. Initializes the local STRUCT pointer line to point to linetbl[lineno].
2. Scans the DCB table looking for active terminals on line LINENO. When one is
found, the first link word in the DCB is set to zero; this is done so that when the line
is restarted, attempts to insert the DCB on a linked list will not fail.
Also cleared is dcb.iocbaddr. This is done to prevent hanging up terminals on the
line that are also stopping (see STOP^DEVICE^HANDLER below).
3. The state word in the line table entry for the line being downed is set to zero.
STOP^DEVICE^HANDLER simply cancels any outstanding terminal I/O. Notice that
the subprocedure waits until dcb.iocbaddr is zero before returning. This is to ensure that
the LINE^HANDLER (STOP^LINE) has processed the cancel before the task is deleted.
Note that in the USER^STOP procedure body, the determination of which subprocedure
to call is based on whether the openid for the stopping task is equal to -1. If it is not -1,
this is a DEVICE^HANDLER task being terminated, and GDSX is functioning as an
Envoy LINE^HANDLER. As the default value of openid is -1, if the current openid is
-1, this is either a LINE^HANDLER terminating, or GDSX is not functioning as an
Envoy LINE^HANDLER. This determination is made by testing MAXLINES, which is
nonzero if GDSX is functioning as a LINE^HANDLER.
The LINE^HANDLER Procedure
The following paragraphs comprise a top-down description of LINE^HANDLER
processing:
The main body of LINE^HANDLER consists solely of a call to the subprocedure
LINE^HANDLER^BODY. LINE^HANDLER^BODY declares an IOCB pointer, the
address of which is assigned by a call to ^LISTEN.
First, a call is made to ^CHECKPOINT(1) to checkpoint the task stack. This is the only
call to ^CHECKPOINT in the LINE^HANDLER and merely serves to speed up
takeover after a failure.
Next LINE^HANDLER^BODY posts ^READUPDATE operations on $RECEIVE and
IN^QUEUE^FILE^NUM and calls the subprocedure LINE^STATE^MACHINE to start
the line. Although the parameter IOCB does not contain a valid IOCB address, the state
machine does not expect any IOCB to be associated with this call and does not reference
the parameter.
LINE^HANDLER^BODY then enters its main processing loop. The first step in this
loop is a CASE statement based on the value returned from WAIT^EVENT. This is the
only call to WAIT^EVENT in LINE^HANDLER. The events waited on are
DISP^CAN, DISP^IMSG, DISP^IOC, and DISP^ITC. In addition, if no event occurs in
10 seconds, the wait will time out.