Receiving (Collecting) Mail [ Interprocess Communication:Programmer's Guide ] MPE/iX 5.0 Documentation
Interprocess Communication:Programmer's Guide
Receiving (Collecting) Mail
A process collects mail transmitted from its parent or a child with the
RECEIVEMAIL intrinsic. If the mailbox for the receiving process is
empty, the action taken depends on the waitflag parameter specified in
RECEIVEMAIL.
To collect a message from a child process, the following intrinsic call
could be used:
STAT:=RECEIVEMAIL(CHILDPIN,MDATA,WAITSTAT);
The parameters specified are:
pin CHILDPIN, which contains the Process Identification
Number of the child process (0 for parent process).
location MDATA, an array in the stack in which the incoming mail
will be stored.
waitflag WAITSTAT, a 16-bit unsigned integer value. If bit
(15:1)=1, the intrinsic will wait until the incoming
mail is ready for collection. If bit (15:1)=0, the
intrinsic will return to the calling process
immediately.
One of the following status codes is returned to STAT:
Status Meaning
0 The mailbox was empty (and WAITSTAT bit (15:1)=0).
1 No message was collected because the mailbox contained
outgoing mail from the receiving process.
2 The message was collected successfully.
3 An error occurred because of an illegal pin or a bounds
check failed.
4 The request was rejected because waitflag specified that
the receiving process should wait for mail if the
mailbox is empty, but the other process sharing the
mailbox is already suspended, waiting for mail. If both
processes were blocked, neither could activate the
other, and they could be deadlocked.
MPE/iX 5.0 Documentation