GDSX Manual

DEVICE^HANDLER Example, Design
Extended General Device Support (GDSX) Manual134303
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.
You would no longer have access to nowait I/O tags for application-specific
purposes.
Therefore, in designing GDSX an additional layer of TSCODE software was placed
between USCODE and the Guardian file system, NonStop TS/MP server classes, and
the TMF product. This layer of software (called pseudo procedures) allows GDSX to
Figure 5-1. DEVICE^HANDLER Task Run-Time Environment
D^H Task
D^H Task
Monitor Task
Listener Task
TERM^FILE^NUM
TERM^FILE^NUMPseudo-
$RECEIVE File
Pseudo-
$RECEIVE File
$RECEIVE
TSCODE
$GDS
Requester
Requester