Receive an asynchronous message
Asynchronous messaging is an experimental feature; for information about the use of experimental software, see the Commercial Software License Agreement (CSLA) or Partner Software License Agreement (PSLA) in the Licensing area of our website, http://www.qnx.com/legal/licensing/. |
#include <sys/asyncmsg.h> struct _asyncmsg_get_header *asyncmsg_get( int chid );
libasyncmsg
Use the -l asyncmsg option to qcc to link against this library.
The asyncmsg_get() function receives up to five asynchronous messages from the channel identified by the chid argument. In order to receive more messages, you must call this function in a loop until the function returns NULL and sets errno to EAGAIN to signify that you've drained the queue of messages.
Threads that receive asynchronous messages don't inherit the sender's priority. |
If you provided a callback function when you called asyncmsg_channel_create(), asyncmsg_get() invokes the callback to allocate space for the message; otherwise asyncmsg_get() invokes malloc().
The asyncmsg_get() function stores each asynchronous message in an _asyncmsg_get_header structure:
struct _asyncmsg_get_header { struct _msg_info info; int err; iov_t *iov; int parts; struct _asyncmsg_get_header *next; unsigned reserve[2]; };
The members include:
A pointer to a linked list of _asyncmsg_get_header structures containing the messages received, or NULL if an error occurred (errno is set).
You should free this list of headers when you're finished with them. |
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | No |
Thread | Yes |
asyncmsg_channel_create(), asyncmsg_channel_destroy(), asyncmsg_connect_attach(), asyncmsg_connect_attr(), asyncmsg_connect_detach(), asyncmsg_flush(), asyncmsg_free(), asyncmsg_malloc(), asyncmsg_put(), asyncmsg_putv()
Asynchronous Messaging technote