GDSX (Extended General Device Support) Manual
Service Routines
Extended General Device Support (GDSX) Manual—529931-001
8-10
^AWAITIO[X]
Example
In this example an IOCB is allocated by USCODE and then deallocated when it is no
longer needed.
INT .EXT IOCB (IOCB^TEMPLATE); !<- Now an INT .EXT
INT timeout := 1000; ! Wait for 10 seconds
INT(32) iocbaddr := 0D; !<- Now an INT(32)
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, .... );