GDSX (Extended General Device Support) Manual

Service Routines
Extended General Device Support (GDSX) Manual529931-001
8-45
^LISTEN
Example
The TCB address specified by tcb-address can be obtained by declaring and initializing
code in your user task as shown in the following example. Once the task has an ITC
file number, it uses ^READUPDATE to check for incoming ITC messages.
PROC DEVICE^HANDLER (term^file^num,
internal^term^no,
term^type);
INT .EXT my^dcb (dcb^template) := 0D;
INT .EXT my^tcb (tcb^template) := 0D;
INT itc^filenumber := 0D;
.
.
@my^dcb := dcbtbl[internal^term^no];
@my^tcb := my^dcb.tcbaddr;
error := ITC^OPENX (my^tcb, itc-filenumber)
IF itc^filenumber THEN
BEGIN
^READUPDATE (itc^filenumber);
IF = THEN
CALL ^AWAITIO (itc^filenumber, ...);
^LISTEN
This procedure looks for completed I/O operations for the calling task. Either an IOCB
address or zero is returned to the calling task.
iocb
returned value
INT(32):value
indicates the outcome of the operation. If a completed I/O specified by the imsg,
i-o-message, or itc-flag parameter settings was found, iocb contains the IOCB
address for the I/O. If the I/O was not found, iocb is set to 0.
imsg input
INT:value
is a flag which, if nonzero, causes ^LISTEN to look for requests from $RECEIVE.
Set to zero if you are looking for completions on other files.
i-o-message input
INT:value
iocb := ^LISTEN ( imsg !
i
,i-o-message !
i
,itc-flag ); !
i