mq_notify()

notify process that a message is available 

Realtime Function


SYNOPSIS

#include <mqueue.h>

int mq_notify(mqd_t mqdes, const struct sigevent *notification);


DESCRIPTION

The mq_notify() function controls whether or not the calling process is notified of messages arriving at the specified message queue as identified by the message queue descriptor, mqdes. The notification argument points to a sigevent structure defining the notification to be sent, if any. struct sigevent is defined in the signal.h header.

If notification is not NULL, mq_notify() registers the calling process to be notified when a message arrives at the specified message queue. When a message arrives at the queue (that is, the queue is no longer empty), the specified notification is sent to the calling process. Only one process at a time can be registered for notification by a message queue. Once any process (including the calling process) is registered for notification by the specified message queue, further attempts to register for that queue fail.

If notification is NULL and the calling process is currently registered for notification by the specified message queue, mq_notify() removes the existing registration.

Once a registered process has been sent notification, its registration is removed, making the message queue once again available for registration.

If a registered process is awaiting notification of message arrival at the specified message queue and some thread is blocked in mq_receive() also awaiting message arrival at the same queue, an arriving message satisfies the appropriate mg_receive() and no notification is sent.


PARAMETERS

mqdes 

Is a message queue descriptor.

notification 

Points to a sigevent structure which identifies the notification to be sent.


RETURN VALUES

On success, mq_notify() returns 0. On failure, it returns -1 and sets errno to one of the following:

EBADF 

mqdes is not a valid message queue descriptor.

EBUSY 

The specified message queue already has a process registered for notification.


CONFORMANCE

UNIX 03.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

The NuTCRACKER Platform does not currently implement the setting of SIGEV_THREAD in the sigevent structure.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
mq_open(), mq_send(), mq_timedsend(), msgctl(), msgget(), msgrcv(), msgsnd()


PTC MKS Toolkit 10.4 Documentation Build 39.