mq_notify(3P4) — CX/UX Programmer’s Reference Manual
NAME
mq_notify − attach notification request to a message queue
SYNOPSIS
#include <mqueue.h>
int mq_notify (mqdes, notification);
mqd_t mqdes;
struct sigevent ∗notification;
DESCRIPTION
If the argument notification is not NULL, mq_notify() attaches the specified notification request to the message queue specified by mqdes. When a notification request is attached to a message queue, a signal is sent to the process which attached the notification request when the message queue transitions from empty to non-empty. The signal which is sent is specified by the notification argument.
Only one notification request can be attached to a message queue.
If notification is NULL and the process has previously attached a notification request to the message queue, the attached notification request is detached.
If a process is blocked in mq_receive() waiting to receive a message and a message arrives at the message queue, the mq_receive() will succeed in receiving the message, and no notification is sent.
RETURN VALUE
Upon successful completion, the notification request is attached, and the mq_notify() function returns a value of zero. If any of the following conditions occur, no notification request is attached, a value of -1 is returned, and errno is set to indicate the error:
[EINVAL] The notification structure contains an invalid signal number or an attempt was made to detach a notification request from a mqdes which had not previously attached a notification request.
[EBADF] The mqdes argument is not a valid message queue descriptor.
[EBUSY] A process has already attached a notification request to this message queue.
FILES
/usr/lib/libposix4.a
SEE ALSO
mq_open(3P4), mq_close(3P4), mq_destroy(3P4), mq_send(3P4), mq_receive(3P4), mq_getattr(3P4), "CX/UX Programmer’s Guide".
WARNING
The interface to mq_notify() is based on IEEE Draft Standard P1003.4/D12. This is an unapproved draft, subject to change. Use of information contained in this unapproved draft is at your own risk. This interface will change to reflect any changes made by future drafts of POSIX 1003.4.