GDSX Manual
DEVICE^HANDLER Example, Design
Extended General Device Support (GDSX) Manual–134303
5-3
Task I/O Calls
monitor every I/O operation that is initiated and ensures that each I/O can be properly
handled at completion time. Also, this approach allows GDSX to cancel any I/O
operations that a task has outstanding when the task is stopped.
Given this implementation of I/O, when developing a DEVICE^HANDLER, you must
not use the normal system procedures for I/O (for example, READUPDATE[X],
WRITEREAD[X], FILEINFO). You should use the GDSX pseudo Guardian procedures
(for example, ^READUPDATE[X], ^WRITEREAD[X], ^FILEINFO) that have the
identical functions as the system procedures (with a few exceptions).
For example, instead of sending a WRITEREAD directly to the IOP using the normal
system procedures, a DEVICE^HANDLER task sends it to the file designated by the file
number using the GDSX ^WRITEREAD procedure. Control is then transferred to
TSCODE, which does a Guardian nowaited call on behalf of the task. TSCODE then
returns control to the DEVICE^HANDLER task at the instruction following the
^WRITEREAD.
DEVICE^HANDLER tasks may continue processing while the IOP executes the
^WRITEREAD. Typically, the task issuing the ^WRITEREAD eventually uses a
^AWAITIO to wait for completion of the operation. See Figure 5-2 for an illustration of
WRITEREAD processing in the DEVICE^HANDLER example.
This multithreaded operation would not be possible if a DEVICE^HANDLER task
called Guardian I/O procedures in a waited manner. Even though GDSX may look like
separate processes running in an operating system, from the point of view of the
NonStop Kernel, it is just one process. If a DEVICE^HANDLER task called a waited
I/O, such as a Guardian READ, the whole process, not just the DEVICE^HANDLER
task, would come to a halt, and the other tasks could not be serviced during the
suspension.
A number of Guardian procedures, such as NUMIN, NUMOUT, MYTERM, and
PROCESSHANDLE_DECOMPOSE, are resident system procedures and do not cause
the GDSX process to be suspended. Therefore, they may be called by USCODE.
Note. As a rule, if a Guardian call suspends not just a task but the whole GDSX process, do
not use it.