GDSX Manual

Service Routines
Extended General Device Support (GDSX) Manual134303
8-10
^AWAITIO[X]
BEGIN
IF NOT (iocbaddr := ALLOCATEIOCB (timeout)) = 0D THEN
!IOCB acquired from extended memory
BEGIN
@IOCB := iocbaddr;
END;
IF iocbaddr <> 0D THEN
CALL DEALLOCATEIOCB (IOCB); ! No matter what happens
! remember to deallocate the IOCB control block
^AWAITIO[X]
The ^AWAITIO and ^AWAITIOX procedures complete a previously initiated I/O
operation. Use ^AWAITIOX with the extended 32-bit versions of the I/O procedures
such as ^WRITEX and ^WRITEREADX. AWAITIOX also completes calls made to the
16-bit I/O routines.
Except for the following considerations, the syntax, condition code settings, and
considerations regarding these two procedures are the same as the counterparts in the
Guardian Procedure Calls Reference Manual.
Considerations
^AWAITIO[X] causes the calling task to be suspended.
Nowait I/O operations are completed either with ^AWAITIO[X] or WAIT^EVENT.
WAIT^EVENT is commonly used when you need to detect not only I/O
completions on files, but other events, such as cancellations and notifications of
available resources.
Be careful when you are programming tasks that call both WAIT^EVENT and
^AWAITIO[X], because when the two procedures are used together, ^AWAITIO[X]
can “lose“ events. For example:
INT F1, F2;
.
.
CALL ^WRITE(F1, .... );
.
.
CALL ^WRITE(F2, .... );
CALL ^AWAITIO(F2); !Complete write to F2
.
.
CALL WAIT^EVENT(DISP^IOC); !Wait for F1 write to complete
.
.
If the ^WRITE to file F1 completes before the ^WRITE to F2, TSCODE’s
implementation of ^AWAITIO calls WAIT^EVENT(DISP^IOC .. ) and awakens on
the resulting IOC event for F1, but, not finding an I/O completion for F2 (by a call to