GDSX (Extended General Device Support) Manual

LINE^HANDLER Example, Design
Extended General Device Support (GDSX) Manual529931-001
7-2
Environment of an Executing LINE^HANDLER Task
ITC file numbers are not actual Guardian file numbers, but values assigned by
TSCODE to DEVICE^HANDLER tasks whose messages are to be routed to
associated LINE^HANDLER tasks. See Figure 7-3 for an illustration of
LINE^HANDLER message flow. When TSCODE receives an I/O request from a
DEVICE^HANDLER task, it examines the file number in the variable term^file^num. If
term^file^num is a Guardian file, the I/O request is sent directly to the IOP. However, if
the file number is an ITC file, the request is sent to the associated LINE^HANDLER
task.
Thus in this example, term^file^num represents a thread from the DEVICE^HANDLER
task through the ITC file to the LINE^HANDLER task, and then to the terminal.
DEVICE^HANDLER tasks are unaware of LINE^HANDLER tasks and intertask
communication with LINE^HANDLER tasks. The DEVICE^HANDLER sends
messages to term^file^num, just as it would if there were no LINE^HANDLER, and
TSCODE handles the routing of the message to the LINE^HANDLER.
In Section 6, LINE^HANDLER Example, Running and Managing, after a terminal file
number was assigned, TSCODE called the DEVICE^HANDLER procedure, creating a
DEVICE^HANDLER task and passing the terminal file number as a parameter. The
task read from, and replied to, incoming messages by way of a pseudo-$RECEIVE file
(with GDSX internal file number 0), which TSCODE automatically opened for the task
just before creating the task.
Figure 7-1. LINE^HANDLER Run-Time Environment
Requester
$GDS
TSCODE
VST023.vsd
Requester
Requester
$RECEIVE
D^H Task
D^H Task
D^H Task
IN^QUEUE^
FILE^NUM
L^H Task
0
Monitor
Listener
LINE^
FILE^
NUM