Guardian Programmer's Guide

Table Of Contents
Communicating With Processes
Guardian Programmer’s Guide 421922-014
6 - 18
Reading Messages for Concurrent Processing
Reading Messages for Concurrent Processing
You use the READUPDATE[X] procedure to read each message without terminating
the corresponding WRITEREAD[X] call. The WRITEREAD[X] procedure finishes when
you reply to the message using the REPLY[X] procedure. With queued messages,
however, you should use message tags to make sure that each reply goes to the
process that sent the message you are replying to.
When processing several messages concurrently, there needs to be a way to identify
each message. The message tag returned by the FILE_GETRECEIVEINFO_
procedure can be used for this purpose. Remember that FILE_GETRECEIVEINFO_
gets information about the most recently read message. You therefore need to issue a
call to this procedure following each READUPDATE call; for example:
CALL READUPDATEX(RECV^NUM,
SBUFFER0,
RCOUNT);
IF <> THEN ...;
ERROR := FILE_GETRECEIVEINFO_(INFORMATION);
IF ERROR <> 0 THEN ...;
TAG0 := INFORMATION[2];
.
.
CALL READUPDATEX(RECV^NUM,
SBUFFER1,
RCOUNT);
IF <> THEN ...;
ERROR := FILE_GETRECEIVEINFO_(INFORMATION);
IF ERROR <> 0 THEN ...;
TAG1 := INFORMATION[2];
.
.
CALL READUPDATEX(RECV^NUM,
SBUFFER2,
RCOUNT);
IF <> THEN ...;
ERROR := FILE_GETRECEIVEINFO_(INFORMATION);
IF ERROR <> 0 THEN ...;
TAG2 := INFORMATION[2];
.
.