HPlogo 900 Series HP 3000 Computer Systems: MPE/iX Intrinsics Reference Manual > Chapter 4 Command Definitions

RECEIVEMAIL

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

NM and CM callable.

Receives mail from another process. Process handling (PH) capability is required.

Syntax

      U16                I16V  UDS     U16V

   mailstatus:=RECEIVEMAIL(pin,location,waitflag);

Functional Return

mailstatus

16-bit unsigned integer (assigned functional return)

Returns one of the following values:

ValueMeaning
0Mailbox empty and waitflag bit (15:1)=0.
1No message collected, the mailbox contained outgoing mail from the receiving process.
2Message collected successfully.
3Error occurred because an invalid pin was specified or a bounds check failed.
4Request denied, waitflag specified that the receiving process 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 suspended, neither could activate the other, and they may be deadlocked.

Parameters

pin

16-bit signed integer by value (required)

The process sending the mail. If you specify a child process, pin is the process identification number (PIN) of that process. If you specify a parent process, pin is zero.

location

user-defined structure (required)

The buffer where the message is written.

waitflag

16-bit unsigned integer by value (required)

The action to be taken if the mailbox is empty. This is determined by the setting of bit (15:1), which has the following settings:

ValueMeaning
0Return immediately to the calling process.
1Wait until incoming mail is ready for collection.

Operation Notes

The RECEIVEMAIL intrinsic lets a process collect mail transmitted to it by its parent or a child. If the mailbox for the receiving process is empty, the action taken depends on the waitflag parameter specified in the RECEIVEMAIL intrinsic call. If the mailbox is currently in use by another process, RECEIVEMAIL waits until the mailbox is free before accessing it.

Condition Codes

CCE (2)

Request granted. The mail was collected (value 2 is returned to mailstatus) or the mail was not collected because the mailbox contained outgoing mail from the receiving process (value 1 is returned to mailstatus).

CCG (0)

Request denied. An illegal pin parameter (value 3 is returned to mailstatus).

CCL (1)

Request denied. The location parameter does not allow write access on the stack address (value 3 is returned to mailstatus) or because both sending and receiving processes are waiting for incoming mail, causing a deadlock (value 4 is returned to mailstatus).

Related Information

Intrinsics

None

Commands

None

Manuals

Interprocess Communication Programmer's Guide (32650-90019)

Feedback to webmaster