Guardian Programmer's Guide

Table Of Contents
Communicating With Processes
Guardian Programmer’s Guide 421922-014
6 - 5
Opening a Process
Examples of Opening a Process
The following example opens process $SER1 for waited I/O.
FILE^NAME := "$SER1" -> @S^PTR;
LENGTH := @S^PTR '-' @FILE^NAME;
ERROR := FILE_OPEN_(FILE^NAME:LENGTH,
PROC^NUM);
IF ERROR <> 0 THEN ...
Alternatively, you can open the server file for nowait I/O:
NOWAIT^DEPTH := 1;
FILE^NAME ':=' "$SER1" -> @S^PTR;
LENGTH := @S^PTR '-' @FILE^NAME;
ERROR := FILE_OPEN_(FILE^NAME:LENGTH,
PROC^NUM,
!access!,
!exclusion!,
NOWAIT^DEPTH);
IF ERROR <> 0 THEN ...
The use of waited or nowait I/O affects the way you send messages to the server
process. Writing Messages to Another Process, later in this section, explains this.
When Does the Open Finish?
The sample code fragments for opening a process work for opening any server
process. However, the time at which the open finishes depends on the way the server
process opens $RECEIVE.
If the server has not yet opened $RECEIVE, the requesters open will not finish until it
does. Once the server opens $RECEIVE, the open finishes at one of three points in
time:
If the server opens $RECEIVE without requesting system messages, the
requester’s open finishes as soon as the server has opened $RECEIVE.
If the server opens $RECEIVE to request system messages and to enable two-
way communication (receive-depth parameter set to a value greater than zero),
the requesters open finishes when the server replies to the Open message.
If the server opens $RECEIVE to request system messages but does not enable
two-way communication (receive-depth parameter set to zero), the requester’s
open finishes when the server reads the Open message.
See Receiving and Processing System Messages, later in this section, for information
about opening $RECEIVE to receive system messages.
See Opening $RECEIVE for Two-Way Communication and Opening $RECEIVE for
One-Way Communication later in this section for details about setting the
receive-depth parameter.