Send a message to a channel (non-cancellation point)
#include <sys/neutrino.h> int MsgSendnc( int coid, const void* smsg, int sbytes, void* rmsg, int rbytes ); int MsgSendnc_r( int coid, const void* smsg, int sbytes, void* rmsg, int rbytes );
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The MsgSendnc() and MsgSendnc_r() kernel calls send a message to a process's channel via the connection identified by coid.
These functions are identical except in the way they indicate errors. See the Returns section for details.
The number of bytes transferred is the minimum of that specified by both the sender and the receiver. The send data isn't allowed to overflow the receive buffer area provided by the receiver. The reply data isn't allowed to overflow the reply buffer area provided.
The sending thread becomes blocked waiting for a reply. If the receiving process has a thread that's RECEIVE-blocked on the channel, the transfer of data into its address space occurs immediately, and the receiving thread is unblocked and made ready to run. The sending thread becomes REPLY-blocked. If there are no waiting threads on the channel, the sending thread becomes SEND-blocked and is placed in a queue (perhaps with other threads). In this case the actual transfer of data doesn't occur until a receiving thread receives on the channel. At this point, the sending thread becomes REPLY-blocked.
|The receiving thread's effective priority might change when you send a message to it. For more information, see “Priority inheritance and messages” in the Interprocess Communication (IPC) chapter of the System Architecture guide.|
MsgSend() is a cancellation point for the ThreadCancel() kernel call; MsgSendnc() isn't.
The only difference between the MsgSendnc() and MsgSendnc_r() functions is the way they indicate errors:
The maximum size for a one-part message-pass is SSIZE_MAX (i.e., 231 − 1) bytes.
ConnectAttach(), MsgError(), MsgReceive(), MsgReceivev(), MsgReply(), MsgReplyv(), MsgSend(), MsgSendPulse(), MsgSendsv(), MsgSendsvnc(), MsgSendv(), MsgSendvnc(), MsgSendvs(), MsgSendvsnc(), name_open(), TimerTimeout()
Message Passing chapter of Getting Started with QNX Neutrino