1mq_notify(3C) Standard C Library Functions mq_notify(3C)
2
3
4
6 mq_notify - notify process (or thread) that a message is available on a
7 queue
8
10 #include <mqueue.h>
11
12 int mq_notify(mqd_t mqdes, const struct sigevent *notification);
13
14
16 The mq_notify() function provides an asynchronous mechanism for pro‐
17 cesses to receive notice that messages are available in a message
18 queue, rather than synchronously blocking (waiting) in mq_receive(3C).
19
20
21 If notification is not NULL, this function registers the calling
22 process to be notified of message arrival at an empty message queue
23 associated with the message queue descriptor, mqdes. The notification
24 specified by notification will be sent to the process when the message
25 queue transitions from empty to non-empty. See signal.h(3HEAD). At any
26 time, only one process may be registered for notification by a specific
27 message queue. If the calling process or any other process has already
28 registered for notification of message arrival at the specified message
29 queue, subsequent attempts to register for that message queue will
30 fail.
31
32
33 If notification is NULL and the process is currently registered for
34 notification by the specified message queue, the existing registration
35 is removed. The message queue is then available for future registra‐
36 tion.
37
38
39 When the notification is sent to the registered process, its registra‐
40 tion is removed. The message queue is then available for registration.
41
42
43 If a process has registered for notification of message arrival at a
44 message queue and some processes is blocked in mq_receive(3C) waiting
45 to receive a message when a message arrives at the queue, the arriving
46 message will be received by the appropriate mq_receive(3C), and no
47 notification will be sent to the registered process. The resulting
48 behavior is as if the message queue remains empty, and this notifica‐
49 tion will not be sent until the next arrival of a message at this
50 queue.
51
52
53 Any notification registration is removed if the calling process either
54 closes the message queue or exits.
55
57 Upon successful completion, mq_notify() returns 0; otherwise, it
58 returns −1 and sets errno to indicate the error.
59
61 The mq_notify() function will fail if:
62
63 EBADF The mqdes argument is not a valid message queue descriptor.
64
65
66 EBUSY A process is already registered for notification by the mes‐
67 sage queue.
68
69
71 See attributes(5) for descriptions of the following attributes:
72
73
74
75
76 ┌─────────────────────────────┬─────────────────────────────┐
77 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
78 ├─────────────────────────────┼─────────────────────────────┤
79 │Interface Stability │Committed │
80 ├─────────────────────────────┼─────────────────────────────┤
81 │MT-Level │MT-Safe │
82 ├─────────────────────────────┼─────────────────────────────┤
83 │Standard │See standards(5). │
84 └─────────────────────────────┴─────────────────────────────┘
85
87 mq_close(3C), mq_open(3C), mq_receive(3C), mq_send(3C),
88 mqueue.h(3HEAD), siginfo.h(3HEAD), signal.h(3HEAD), attributes(5),
89 standards(5)
90
91
92
93SunOS 5.11 5 Feb 2008 mq_notify(3C)