| 
|  | » |  | 
 |  | 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: pinCHILDPIN, which contains the Process Identification Number of the child process (0 for parent process).locationMDATA, an array in the stack in which the incoming mail will be stored.waitflagWAITSTAT, 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: StatusMeaning0The mailbox was empty (and WAITSTAT bit (15:1)=0)1No message was collected because the mailbox contained outgoing mail from the receiving process.2The message was collected successfully.3An error occurred because of an illegal pin or a bounds check 
failed.4The 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.
 |