Guardian Programmer's Guide

Table Of Contents
Using Nowait Input/Output
Guardian Programmer’s Guide 421922-014
4 - 8
Using File-System Buffering
BYTES := 25;
LENGTH := 512;
CALL WRITEREADX(F4,
BUFFER2,
BYTES,
LENGTH,
TAG2);
IF <> THEN ...
BYTES := 12;
LENGTH := 512;
CALL WRITEREADX(F4,
BUFFER3,
BYTES,
LENGTH,
TAG3);
IF <> THEN ...
.
.
.
CALL AWAITIOX(F4,
!buffer^address!,
BYTE^COUNT,
TAG);
IF <> THEN ...
The sixth parameter (tag) of each WRITEREADX call assigns a unique tag. The
AWAITIOX procedure retrieves the tag value in its own tag parameter and thereby
identifies the completing operation. All procedures that are affected by nowait I/O can
set the value of the tag.
The above example shows only one AWAITIOX call. You typically place this call in a
loop that repeats for each initiated I/O.
Using File-System Buffering
HP recommends that you use a different application buffer for each concurrent read
operation. However, if you must use the same buffer, then you need to use an
intermediate file-system buffer to prevent the read operations from corrupting each
others buffered data. You make use of file-system buffers by issuing SETMODE
function 72.
For files opened with the FILE_OPEN_ procedure, the operating system normally
transfers data directly between the application buffer and the I/O buffer. If concurrent
operations use the same application buffer, it is possible that one such operation
overwrites the buffer before some other operation has completed its transfer. The
result is that one of these operations transfers corrupted data.
Caution. You should not use file-system buffering with WRITE or WRITEREAD operations,
because you can still corrupt your data when the file system performs implicit retry operations.