GDSX Manual
Design and Development
Extended General Device Support (GDSX) Manual–134303
2-92
Intertask Communication
The first consideration for this type of facility is the allocation of device file numbers.
File numbers F in the range:
(MAXFILES - MAXTSK + MAXLINES + 5)< F <= MAXFILES
are reserved for ITC files. If a TSCODE call to the Guardian procedure OPEN returns a
file number in this range, ^OPEN closes the file and returns file error 32
(FENOCBSPACE) to the calling task’s ^FILEINFO(-1,..).
When initiating a new user task, TSCODE allocates the largest currently unused number
in the ITC range and assigns it as that task’s file number. The FCB for the file is set up
as follows:
So that GDSX $RECEIVE handling would not need to be changed, a file separate from
$RECEIVE was used for the LINE^HANDLER’s input queue. The actual value passed
to each LINE^HANDLER in the in^queue^file^num parameter is MAXFILES + 1.
When a DEVICE^HANDLER task initiates an I/O operation, the TSCODE-supported
service routines examine the file number passed to them. If the number is in the ITC
range, the request is routed to the associated LINE^HANDLER task by a call on the
procedure SEND^ITC^MSG.
The SEND^ITC^MSG procedure allocates an IOCB and links it to the
DEVICE^HANDLER’s TCB and the ITC file’s FCB, just as the IOCB would be for a
Guardian file. If the LINE^HANDLER has a current ^READUPDATE on its ITC file,
the IOCB is also linked to the LINE^HANDLER’s ITC request queue. The I/O
initiation is completed by causing the LINE^HANDLER’s ITC event.
LINE^HANDLER Processing
After the LINE^HANDLER task’s WAIT^EVENT returns E^ITC, the task calls
^LISTEN(0,0,1). ^LISTEN looks at the LINE^HANDLER’s ITC request queue; if the
queue is nonempty, the first element in the queue is delinked from the queue, its state is
changed to 6 (active), and its address is returned.
When the task finishes processing the request and calls NOTIFY^IO^COMPLETION,
the IOCB is delinked from the DEVICE^HANDLER task’s TCB and the ITC file’s FCB
and is queued on the DEVICE^HANDLER task’s completed I/O list. Also, the IOCB’s
state is changed to 5 (pending). Finally, the DEVICE^HANDLER task’s IOC event is
posted. This is the same action that takes place when a Guardian I/O operation
completes.
Canceling a Request
When a DEVICE^HANDLER task cancels an I/O that is linked to its tcb.iocbh, the
^CANCELREQ procedure locates the associated IOCB just as it would for a Guardian
fcb.public 0
fcb.lhaddr Address of LINE^HANDLER’s TCB
fcb.owner Address of DEVICE^HANDLER task’s TCB
fcb.type 1