Caution: This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.

asyncmsg_put(), asyncmsg_putv()

Send an asynchronous message to a connection

Synopsis:

#include <sys/neutrino.h>
#include <sys/asyncmsg.h>

int asyncmsg_put(int coid, const void *buff, size_t size, 
                 unsigned handler),
  
int asyncmsg_putv(int coid, const iov_t* iov, int parts, 
                 unsigned handler,

int (*call_back) (int err, void* buf, unsigned handler)



Arguments:

coid
The connection ID the message is sent to.
buff
A pointer to the buffer where the message comes from.
size
The size of the message.
iov
A pointer to an array of buffers where the message is taken from.
parts
The number of elements in the array.
handler
A user-defined handle that's passed back in the call_back function to allow for quick identification of the message's package.
call_back
The call_back function tells the application that one of the messages is processed. If NULL is returned the call_back in the asyncmsg_connect_attach() will be used.

Library:

libasyncmsg

Use the -l asyncmsg option to qcc to link against this library.

Description:

The asyncmsg_put() and asyncmsg_putv() functions take asynchronous messages from the buffer pointed to by buff, and sends them to the connections identified by the coid arguments. The messages could be associated with a user-defined handle which will be passed back in the call_back function (for error or buffer claim notification) to allow the user to quickly find out which package it is.

The call_back function tells the application that one of the messages is processed. If NULL is returned the call_back in the asyncmsg_connect_attach() will be used.

Returns:

EOK on success; or -1 if an error occurred (errno is set).

Errors:

EBADF
The connection specified by coid doesn't exist.
EFAULT
A fault occurred when the kernel tried to access the buffers provided.
EAGAIN
The send queue is full.

Classification:

QNX Neutrino

Safety:
Cancellation point No
Interrupt handler No
Signal handler No
Thread Yes

See also:

asyncmsg_channel_create(), asyncmsg_channel_destroy(), asyncmsg_connect_attach(), asyncmsg_connect_attr(), asyncmsg_connect_detach(), asyncmsg_flush(), asyncmsg_free(), asyncmsg_get(), asyncmsg_malloc()

Asynchronous Messaging Technote