Guardian Programmer's Guide

Table Of Contents
Using Nowait Input/Output
Guardian Programmer’s Guide 421922-014
4 - 7
Completing I/Os in Any Order
Completing I/Os in Any Order
Now consider what happens when I/O operations are allowed to finish in any order.
Two different uses of the SETMODE procedure produce slightly different results:
Setting parameter-1 to 1 causes I/O operations to finish in any order, except if
more than one operation is ready to finish at the time of the AWAITIO[X] call. In
this case, the operations that are ready finish in their issued order.
Setting parameter-1 to 3 causes I/O operations to finish in the order chosen by
the operating system to be most efficient.
The next example shows how to use function 30 of the SETMODE procedure to permit
I/O operations to finish in any order. Previous examples have simply passed the file
number to the AWAITIOX procedure to identify the completing operation. The file
number is enough to identify the I/O operation if only one such operation per file is
allowed to run concurrently with the program. When you permit more than one
operation per file to run concurrently, however, you need to initiate each operation with
a unique tag so that you can identify the operation when it finishes. The following
example shows this method.
INT(32) TAG, TAG1 := 1D, TAG2 := 2D, TAG3 := 3D;
LITERAL CHOOSE^ORDER = 30,
ANY^ORDER = 1;
.
.
NOWAIT^DEPTH := 4;
ERROR := FILE_OPEN_(PROCESSNAME:LENGTH,
F4,
!access!,
!exclusion!,
NOWAIT^DEPTH);
IF ERROR <> 0 THEN ...
CALL SETMODE(F4,CHOOSE^ORDER,ANY^ORDER);
.
.
.
BYTES := 10;
LENGTH := 512;
CALL WRITEREADX(F4,
BUFFER1,
BYTES,
LENGTH,
TAG1);
IF <> THEN ...