[Previous] [Contents] [Index] [Next]

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

MsgReceivePulsev(), MsgReceivePulsev_r()

Receive a pulse on a channel

Synopsis:

#include <sys/neutrino.h>

int MsgReceivePulsev( int chid,
                      const iov_t * piov,
                      int parts,
                      struct _msg_info * info );

int MsgReceivePulsev_r( int chid,
                        const iov_t * piov,
                        int parts,
                        struct _msg_info * info );

Arguments:

chid
The ID of a channel that you established by calling ChannelCreate().
piov
An array of buffers where the function can store the received data.
parts
The number of elements in the array.
info
The function doesn't update this structure, so you typically pass NULL for this argument.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The MsgReceivePulsev() and MsgReceivePulsev_r() kernel calls wait for a pulse to arrive on the channel identified by chid and places the received data in the array of buffers pointed to by piov.

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 received data isn't allowed to overflow the receive buffer area provided.


Note: The first buffer of the IOV (input/output vector) must be big enough to contain a pulse. If it isn't, the functions indicate an error of EFAULT.

If a pulse is waiting on the channel when you call MsgReceivePulsev(), the calling thread doesn't block, and the pulse is immediately copied. If a pulse isn't waiting, the calling thread enters the RECEIVE-blocked state until a pulse arrives.

If multiple pulses are sent to a channel without a thread waiting to receive them, the pulses are queued in priority order.

On success, MsgReceivePulsev() and MsgReceivePulsev_r() return 0 to indicate that they received a pulse. When a pulse is received:

Blocking states

State Meaning
STATE_RECEIVE There's no pulse waiting.

Returns:

The only difference between MsgReceivePulsev() and MsgReceivePulsev_r() is the way they indicate errors. On success, they both return 0.

If an error occurs:

Errors:

EFAULT
A fault occurred when the kernel tried to access the buffers provided. Because the OS accesses the sender's buffers only when MsgReceivePulsev() is called, a fault could occur in the sender if the sender's buffers are invalid. If a fault occurs when accessing the sender buffers (only) they'll receive an EFAULT and MsgReceivePulsev() won't unblock.
EINTR
The call was interrupted by a signal.
ESRCH
The channel indicated by chid doesn't exist.
ETIMEDOUT
A kernel timeout unblocked the call. See TimerTimeout().

Classification:

QNX Neutrino

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

See also:

MsgDeliverEvent(), MsgReceive(), MsgReceivePulse(), MsgReceivev(), MsgSendPulse(), _pulse, TimerTimeout()


[Previous] [Contents] [Index] [Next]