Guardian Programmer's Guide

Table Of Contents
Using the Sequential Input/Output Procedures
Guardian Programmer’s Guide 421922-014
15 - 45
Handling Interprocess Messages
!Or if response came from terminal 2:
BEGIN
!Establish the error value returned from AWAITIO:
CALL FILE_GETINFO_(T2^FNUM,ERROR);
!Update the FCB to indicate I/O complete:
CALL SET^FILE(TERM2,SET^PHYSIOOUT,0);
!Update the FCB with the number of bytes transferred:
CALL SET^FILE(TERM2,SET^COUNTXFERRED,RCOUNT);
!Update the FCB with the error number returned from the
!FILE_GETINFO_ call following AWAITIO:
CALL SET^FILE(TERM2,SET^ERROR,ERROR);
!Update the file-state information:
CALL WAIT^FILE(TERM2,BYTES^READ);
!Process the read from terminal 2
.
.
END;
Handling Interprocess Messages
This subsection discusses how processes communicate with each other using SIO
procedures. The SIO procedures perform most of the functions provided by the
regular Guardian procedures.
As when working with file-system procedures directly, you send a message to another
process and wait for a reply. Typically, data is expected in the reply; see Passing
Messages and Reply Text Between Processes, later in this subsection. However, you
can use a simpler model for sending messages and receiving replies if the receiving
process will never send data in the reply; see
Passing Messages Between Processes:
No Reply Data.
Refer to Section 6, Communicating With Processes, for details of interprocess
communication (IPC) features supported by Guardian procedures as well as a
conceptual discussion of IPC.
Passing Messages and Reply Text Between Processes
Typically, when one process sends a message to another process, the recipient
process sends some data back to the sender in a reply. This model of interprocess
communication is sometimes called two-way communication. Here, the requester
process sends a message to the server and then typically waits until the server reads
the message, processes the message, and sends a reply.
Either process can use nowait I/O or waited I/O. The example given later in this
subsection uses waited I/O. The application of nowait I/O to interprocess