A process can determine the status of the mailbox used by its parent or child with the MAIL intrinsic. If the mailbox contains mail that is awaiting collection by this process, the length of the message (in halfwords) is returned to the calling process. This enables the calling process to initialize its stack in preparation for receipt of the message.
For example, to test the status of the mailbox associated with one of its child processes, a process could use the following intrinsic call:
STATCOUNT:=MAIL(CHILDPIN,MCOUNT);
|
CHILDPIN contains the Process Identification Number (PIN) of the child process. An integer count signifying the length, in words,
of the incoming message will be returned to the word MCOUNT.
The status returned to STATCOUNT will be one of the following
values:
- Status
Meaning
- 0
The mailbox is empty.
- 1
The mailbox contains previous outgoing mail from this calling process that has not yet been collected by the destination process.
- 2
The mailbox contains incoming mail awaiting collection by this calling process. The length of the mail is returned in MCOUNT.
- 3
An error occurred because an invalid PIN was specified or a bounds check failed.
- 4
The mailbox is temporarily inaccessible because other intrinsics
are using it to prepare or analyze mail.