Send a pulse (containing a pointer) to a process
#include <sys/neutrino.h> int MsgSendPulsePtr ( int coid, int priority, int code, void *value ); int MsgSendPulsePtr_r ( int coid, int priority, int code, void *value );
Although code can be any 8-bit signed value, you should avoid code values less than zero, in order to avoid conflict with pulse codes generated by the kernel or a QNX Neutrino manager. These codes all start with _PULSE_CODE_ and are defined in <sys/neutrino.h>; for more information, see the documentation for the _pulse structure. A safe range of pulse values is _PULSE_CODE_MINAVAIL through _PULSE_CODE_MAXAVAIL.
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The MsgSendPulsePtr() and MsgSendPulsePtr_r() kernel calls send a short, nonblocking 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.
You can use MsgSendPulsePtr() to wake up another thread in the same process and provide it with the address of an object to operate on. It's possible to use this function between processes, but as the pointer will be invalid in the receiving process, it might be clearer to send an integer value by using MsgSendPulse(). If you want to copy the data instead of a pointer to it, use MsgSend().
You can send a pulse to a process if:
Or:
Pulses are queued for the receiving process in the system, using a dynamic pool of memory objects. If pulses are generated faster than they can be consumed by the receiver, then over a period of time the system queue for the pulses could reach a low memory condition. If there's no memory available for the pulse to be queued in the system, the kernel fails the pulse request with an error of EAGAIN. If the priority, code and value don't change, the kernel compresses the pulses by storing an 8-bit count with an already queued pulse.
When you receive a pulse via the MsgReceive*() kernel call, the rcvid returned is zero. This indicates to the receiver that it's a pulse and, unlike a message, shouldn't be replied to using MsgReply*().
Blocking states
None for the local case. In the network case:
Native networking
You can use MsgSendPulsePtr() to send pulses across the network, but there isn't much point in doing so because the pointer value would be meaningless to the receiving process.
The only difference between the MsgSendPulsePtr() and MsgSendPulsePtr_r() functions is the way they indicate errors:
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
If the server faults on delivery, the pulse is either lost or an error is returned.