Receive a pulse on a channel
#include <sys/neutrino.h> int MsgReceivePulse( int chid, void * pulse, int bytes, struct _msg_info * info ); int MsgReceivePulse_r( int chid, void * pulse, int bytes, struct _msg_info * info );
If this buffer isn't big enough to contain a struct _pulse structure, you'll get an EFAULT. |
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The MsgReceivePulse() and MsgReceivePulse_r() kernel calls wait for a pulse to arrive on the channel identified by chid and place the received data in the buffer pointed to by pulse. If the buffer is large enough, the number of bytes written to it is the size of a struct _pulse structure.
These functions are identical, except in the way they indicate errors; see the Returns section for details.
If a pulse is waiting on the channel when you call MsgReceivePulse(), 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.
When a thread receives a pulse:
Don't reply to a pulse. |
The only difference between MsgReceivePulse() and MsgReceivePulse_r() is the way they indicate errors. On success, they both return 0.
If an error occurred:
Safety: | |
---|---|
Cancellation point | Yes |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
MsgDeliverEvent(), MsgReceive(), MsgReceivePulsev(), MsgReceivev(), MsgSendPulse(), _pulse, TimerTimeout()
Message Passing chapter of Getting Started with QNX Neutrino