Send an asynchronous message to a connection
CAUTION:
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/.
Note:
Asynchronous messaging support is in its own kernel module.
In order to use it, you must add [module=async] to the procnto
line of your mkifs buildfile.
Synopsis:
#include <sys/asyncmsg.h>
int asyncmsg_put( int coid,
const void *buff,
size_t size,
unsigned handle),
int (*call_back) (
int err,
void* buf,
unsigned handle ));
int asyncmsg_putv( int coid,
const iov_t* iov,
int parts,
unsigned handle,
int (*call_back) (
int err,
void* buf,
unsigned handle ));
Arguments:
- coid
- The ID of the connection to send the message to.
- buff
- (asyncmsg_put() only) A pointer to the buffer that holds the message.
- size
- (asyncmsg_put() only) The size of the message.
- iov
- (asyncmsg_putv() only)
A pointer to an array of IOV buffers that hold message.
- parts
- (asyncmsg_putv() only) The number of elements in the IOV array.
- handle
- A user-defined handle that's passed to the call_back function
to allow for quick identification of the message's package.
- call_back
- NULL, or a function to call when a message is processed.
If this argument is NULL, the call_back
specified in the
_asyncmsg_connection_attr
passed to
asyncmsg_connect_attach()
is called.
Library:
libasyncmsg
Use the -l asyncmsg option to
qcc
to link against this library.
Description:
The asyncmsg_put() and asyncmsg_putv() functions send
an asynchronous message to the connection identified by the coid
argument:
- For asyncmsg_put(), buff points to the message,
and size specifies its length.
- For asyncmsg_putv(), the message is stored in an I/O vector
pointed to by iov, and parts specifies the number
of entries in the array.
You can use the handle, which is passed to the call_back
function, to help you identify the message.
Returns:
EOK, 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 |