GDSX Manual
Design and Development
Extended General Device Support (GDSX) Manual–134303
2-96
The LINE^HANDLER Procedure
Rather than maintain a list of reading subdevices, a count (readers) of subdevices whose
current request is a READ is maintained. READ^DEVICE increments this count and
calls CHANGELIST to enable polling of this terminal.
After a request has been processed, there is a call to END^WRITE^REQUEST or
END^READ^REQUEST as appropriate.
END^WRITE^REQUEST deletes from the write queue the DCB for the device just
written and calls END^REQUEST. END^READ^REQUEST calls END^REQUEST,
decrements readers, and calls CHANGELIST to disable polling of the device.
END^REQUEST determines whether the passed IOCB is the current request for its
DCB. If it is, END^REQUEST sets dcb.iocbaddr to zero. After setting up iocb.err (if
appropriate), END^REQUEST posts this error for the STATUS SU command in SCF.
Finally, END^REQUEST calls NOTIFY^IO^COMPLETION to complete the
DEVICE^HANDLER task’s I/O operation.
Request cancellation is handled in two steps. Recall that when a cancel event occurs,
the main loop calls CANCEL^REQUESTS. This subprocedure sets the flag
cancel^seen and halts polling. No further action is taken at this time so that there is no
concern about what the state machine is doing with a request when its IOCB is
deallocated. The next time the line is idle, there is a call to subprocedure
CHECK^CANCELS, which finds cancel^seen set and scans all of the line’s active
DCBs checking IOCBs for cancellation.
The line state machine defines six line states, as follows:
Entries in the state transition table (line^state^table) contain four bytes, as follows:
•
Byte 0: Current state
•
Byte 1: Result of previous action
•
Byte 2: Next action
•
Byte 3: Next state
The line state machine consists of an indefinite loop in which:
1. The result of the previous line action is evaluated and stored in the local variable
rslt. This evaluation is done by a CASE FORM expression with the case index
being the current line state. Typed subprocedures return a number indicating the
result of each particular action.
Line State Description
0 - line^closed The line is logically closed. This is the initial line state.
1 - line^idle The line is logically up with no current line activity.
2 - line^polling A read is currently posted on the line.
3 - line^writing A write operation is currently posted on the line.
4 - line^readeot A continuation read is posted on the line.
5 - line^resetting A CONTROL 13 is posted on the line.