Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/m/msgreceivepulse.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/m/msgreceivepulse.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/m/msgreceivepulse.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/m/msgreceivepulse.html on line 8
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 );
- chid
- The ID of a channel that you established by calling
ChannelCreate().
- pulse
- A pointer to a buffer where the function can store the received data.
- bytes
- The size of the buffer.
- info
- The function doesn't update this structure, so you typically pass
NULL for this argument.
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.
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.
|
The pulse buffer 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 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.
|
The thread's effective priority might change when it receives a pulse.
For more information, see
“Priority inheritance and messages”
in the Interprocess Communication (IPC) chapter of the
System Architecture guide. |
On success, MsgReceivePulse() and MsgReceivePulse_r()
return 0 to indicate that they received a pulse.
When a pulse is received:
- the kernel space allocated to hold it is immediately released
- pulse contains a pulse message of type
_pulse.
|
Don't reply to a pulse. |
State
|
Meaning
|
STATE_RECEIVE
|
There's no pulse waiting. |
The only difference between MsgReceivePulse() and
MsgReceivePulse_r() is the way they indicate errors.
On success, they both return 0.
If an error occurred:
- MsgReceivePulse() returns -1 and sets
errno.
- MsgReceivePulse_r() returns the negative of a value from the
Errors section.
This function doesn't set errno.
- EFAULT
- A fault occurred when the kernel tried to access the buffers provided.
Because the OS accesses the sender's buffers only when
MsgReceivePulse() 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 MsgReceivePulse() 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().
QNX Neutrino
Safety: | |
Cancellation point |
No |
Interrupt handler |
No |
Signal handler |
Yes |
Thread |
Yes |
MsgDeliverEvent(),
MsgReceive(),
MsgReceivePulsev(),
MsgReceivev(),
MsgSendPulse(),
_pulse,
TimerTimeout()
Message Passing
chapter of Getting Started with QNX Neutrino
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/m/msgreceivepulse.html on line 278
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/m/msgreceivepulse.html on line 278