QNX Developer Support
Ask to be notified when there's a message in the queue
#include <mqueue.h> int mq_notify( mqd_t mqdes, const struct sigevent* notification );
- The message-queue descriptor, returned by mq_open(), of the message queue that you want to get notification for.
- NULL, or a pointer to a sigevent structure that describes how you want to be notified.
- For the traditional implementation, libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
- For the alternate implementation using asynchronous messages,
Use the -l mq option to qcc to link against this library.
If notification isn't NULL, the mq_notify() function asks the server to notify the calling process when the queue makes the transition from empty to nonempty. The means by which the server is to notify the process is passed in the sigevent structure pointed to by notification. Once the message queue server has notified the process of the transition, the notification is removed.
|Neutrino supports two implementations of message queues: a traditional implementation, and an alternate one that uses asynchronous messages. For more information, see the entry for mq and mqueue in the Utilities Reference.|
We recommend that you use the following event types in this case:
Under normal operation, only one process may register for notification at a time. If a process attempts to attach a notification, and another process is already attached, an error is returned and errno is set to EBUSY.
If a process has registered for notification, and another process is blocked on mq_receive(), then the mq_receive() call is satisfied by any arriving message. The resulting behavior is as if the message queue remained empty.
If notification is NULL and the current process is currently registered for notification, then the existing registration is removed.
-1 if an error occurred (errno is set). Any other value indicates success.
- Invalid message queue mqdes.
- A process has already registered for notification for the given queue.
mq, mqueue in the Utilities Reference