AMS_RECEIVE

Receive any incoming message

Invocation

(void)ams_receive( timeout, message_name_s, message_value_s,
message_status, message_context, message_name, message_length,
message_value, path, messid, status )

Arguments

timeout = int (given)
timeout time in milliseconds

message_name_s = int (given)

maximum space for name (bytes)

message_value_s = int (given)

maximum space for value (bytes)

message_status = int * (returned)

message status

message_context = int * (returned)

message_context

message_name = char * (returned)

message name

message_length = int * (returned)

length of value

message_value = char * (returned)

message value

path = int * (returned)

path on which message received

messid = int * (returned)

message number of incoming message

status = int * (given and returned)

global status

Description:

Looks for a message to this task from any source for ’timeout’ milliseconds. A timeout value of MESSYS__INFINITE indicates no time limit.

Any received message is unpacked appropriately and the contents returned to the calling routine. Only those arguments relevant to the particular message type will be returned.

Note that the received message may be a TIMEOUT message as a result of the timer being set.

Implementation

If ’timeout’ is not MESSYS__INFINITE, the function sets the timer clock going so that we get a timeout if there is no response within ’timeout’ milliseconds. The ATIMER package is used to handle timers.

The function then looks for a message on any of this task’s receive queues and returns the message components.