F.11. para_msg_send

Sends a message to subscribed modules.

Synopsis. 

#include <parabellym/api.h>

int para_msg_send(para_msgi_t *info);

Arguments. 

info
The description of the message.

Access. 

Unrestricted.

Description. 

The para_msg_send function delivers data to one or more modules. The data passed with the message is copied to each module's incoming message queue and may be safely changed after this function returns. If the message does not require a response, the function returns immediately.

If the rreq member of the info block is not set, the message is delivered to all subscribed modules. Otherwise the message is only delivered to the first subscribed module and the function blocks until the module processes the message and replies. When the function unblocks, the attc and attv members of the info block describe the data with which the receiving module had replied. (The data is valid until the next call to the library and must be copied to the module's own memory space.)

When a response arrives, members attc and attv described the data with which the remote module replied; this data must not be deallocated by the module.

A module will not receive messages it sends.

Return value. 

PEC_SUCCESS
The message was successfully sent.
PEC_MSG_BAD_ID
Invalid message identifier was used.
PEC_MSG_NO_RECIPIENT
The message required a response but there were no recipients. This actually means that the calling module is the only module subscribed to the message. Otherwise PEC_MSG_BAD_ID would be reported.