GDSX (Extended General Device Support) Manual

DEVICE^HANDLER Example, Design
Extended General Device Support (GDSX) Manual529931-001
5-2
Task I/O Calls
By means of a typical $RECEIVE file, TSCODE accepts incoming messages
addressed to subdevices under GDSX ($GDS.#TC1, for example). All requester
READ, WRITE, WRITEREAD, CONTROL, and SETMODE messages, and OPEN and
CLOSE messages if sysmsgs^flag of the CONTROLFLAGS configuration parameter is
set, are routed to the DEVICE^HANDLER task managing the device addressed. This
message passing is transparent to the DEVICE^HANDLER tasks. Each task reads
and replies to incoming messages by way of a pseudo-$RECEIVE file (with GDSX
internal file number 0), which TSCODE automatically opens for the task before creating
the task. Thus a DEVICE^HANDLER task does not directly open either its pseudo-
$RECEIVE file or the device that it manages.
Task I/O Calls
The usual strategy for managing I/O in a multithreaded program is to use the nowait
I/O tag facility of the Guardian file system. Such a design could have been
implemented in GDSX by letting you call the file system directly but requiring a
convention for nowait tags. This idea presented two problems:
The program would behave erratically if the you inadvertently supplied the wrong
tag.
Figure 5-1. DEVICE^HANDLER Task Run-Time Environment
D^H Task
Monitor Task
Listener Task
$RECEIVE
Requester
Requester
D^H Task
$GDS
Pseudo-
$RECEIVE File
Pseudo-
$RECEIVE File
TSCODE
VST016.vsd