GDSX Manual

LINE^HANDLER Example, Design
Extended General Device Support (GDSX) Manual134303
7-6
Intertask CommunicationLINE^HANDLER
Perspective
After TSCODE passes a value to the LINE^HANDLER task to indicate what event
occurred, if the event has an IOCB associated with it, the task can call ^LISTEN to get a
pointer to the IOCB. To get the IOCB pointer for a message from a
DEVICE^HANDLER task, use the statement:
@IOCB := ^LISTEN (0, 0, 1);
The third parameter value of 1 indicates an intertask communication.
To get the IOCB pointer for a message passed by TSCODE directly from $RECEIVE,
use the statement:
@IOCB := ^LISTEN (1, 0, 0);
The first parameter value of 1 indicates a message from $RECEIVE.
To get the IOCB pointer for an I/O completion on a file, use the statement:
@IOCB := ^LISTEN (0, i-o-message, 0);
where a nonzero i-o-message is interpreted as a file number from TSCODE for
which the procedure is to look for completed I/Os. A value of -1 for i-o-message
indicates that ^LISTEN looks for all completed I/Os except those for intertask requests
and messages from $RECEIVE.
A method for getting the IOCB for a canceled request is discussed in the next
subsection.
NOTIFY^IO^COMPLETION[X] is a procedure commonly used to complete I/O
operations in a task. A task calls this procedure to notify a DEVICE^HANDLER task
that an intertask request is complete.
All DEVICE^HANDLER tasks may have intertask requests outstanding at the same
time. The LINE^HANDLER task must manage communication of these requests to a
Table 7-1. Events Detected With WAIT^EVENT
Event Description Literal Identifier
Literal
Constant
Associated
IOCB
No event: timeout occurred E^TIMEOUT 0
Request that L^H call STOP^TASK E^STOP 1
Resume processing E^CONTINUE 2
Intertask message or I/O canceled E^CAN 3 X
Message arrived from $RECEIVE E^IMSG 4 X
Intertask message arrived E^ITC 5 X
Completion of I/O other than $RECEIVE and
intertask message
E^IOC 6 X
Resource is available E^RESOURCE 7
Device added, deleted, altered, started, or
stopped
E^CHANGE 8