Merge commit '9276b3991ba20d5a5660887ba81b0bc7bed25a0c'
[unleashed.git] / share / man / man3c / mq_notify.3c
blobdbe734f1a0fbce946078f24a7179ae068ff67644
1 '\" te
2 .\" Copyright (c) 2008, Sun Microsystems, Inc.  All Rights Reserved.
3 .\" Copyright 1989 AT&T
4 .\" Portions Copyright (c) 1992, X/Open Company Limited.  All Rights Reserved.
5 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
6 .\" http://www.opengroup.org/bookstore/.
7 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
8 .\"  This notice shall appear on any product containing this material.
9 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
10 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
11 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
12 .TH MQ_NOTIFY 3C "Feb 5, 2008"
13 .SH NAME
14 mq_notify \- notify process (or thread) that a message is available on a queue
15 .SH SYNOPSIS
16 .LP
17 .nf
18 #include <mqueue.h>
20 \fBint\fR \fBmq_notify\fR(\fBmqd_t\fR \fImqdes\fR, \fBconst struct sigevent *\fR\fInotification\fR);
21 .fi
23 .SH DESCRIPTION
24 .sp
25 .LP
26 The \fBmq_notify()\fR function provides an asynchronous mechanism for processes
27 to receive notice that messages are available in a message queue, rather than
28 synchronously blocking (waiting) in \fBmq_receive\fR(3C).
29 .sp
30 .LP
31 If \fInotification\fR is not \fINULL\fR, this function registers the calling
32 process to be notified of message arrival at an empty message queue associated
33 with the message queue descriptor, \fImqdes\fR. The notification specified by
34 \fInotification\fR will be sent to the process when the message queue
35 transitions from empty to non-empty. See \fBsignal.h\fR(3HEAD). At any time,
36 only one process may be registered for notification by a specific message
37 queue. If the calling process or any other process has already registered for
38 notification of message arrival at the specified message queue, subsequent
39 attempts to register for that message queue will fail.
40 .sp
41 .LP
42 If \fInotification\fR is \fINULL\fR and the process is currently registered for
43 notification by the specified message queue, the existing registration is
44 removed. The message queue is then available for future registration.
45 .sp
46 .LP
47 When the notification is sent to the registered process, its registration is
48 removed. The message queue is then available for registration.
49 .sp
50 .LP
51 If a process has registered for notification of message arrival at a message
52 queue and some processes is blocked in \fBmq_receive\fR(3C) waiting to receive
53 a message when a message arrives at the queue, the arriving message will be
54 received by the appropriate \fBmq_receive\fR(3C), and no notification will be
55 sent to the registered process. The resulting behavior is as if the message
56 queue remains empty, and this notification will not be sent until the next
57 arrival of a message at this queue.
58 .sp
59 .LP
60 Any notification registration is removed if the calling process either closes
61 the message queue or exits.
62 .SH RETURN VALUES
63 .sp
64 .LP
65 Upon successful completion, \fBmq_notify()\fR returns \fB0\fR; otherwise, it
66 returns \fB\(mi1\fR and sets \fBerrno\fR to indicate the error.
67 .SH ERRORS
68 .sp
69 .LP
70 The \fBmq_notify()\fR function will fail if:
71 .sp
72 .ne 2
73 .na
74 \fB\fBEBADF\fR\fR
75 .ad
76 .RS 9n
77 The \fImqdes\fR argument is not a valid message queue descriptor.
78 .RE
80 .sp
81 .ne 2
82 .na
83 \fB\fBEBUSY\fR\fR
84 .ad
85 .RS 9n
86 A process is already registered for notification by the message queue.
87 .RE
89 .SH ATTRIBUTES
90 .sp
91 .LP
92 See \fBattributes\fR(5) for descriptions of the following attributes:
93 .sp
95 .sp
96 .TS
97 box;
98 c | c
99 l | l .
100 ATTRIBUTE TYPE  ATTRIBUTE VALUE
102 Interface Stability     Committed
104 MT-Level        MT-Safe
106 Standard        See \fBstandards\fR(5).
109 .SH SEE ALSO
112 \fBmq_close\fR(3C), \fBmq_open\fR(3C), \fBmq_receive\fR(3C), \fBmq_send\fR(3C),
113 \fBmqueue.h\fR(3HEAD), \fBsiginfo.h\fR(3HEAD), \fBsignal.h\fR(3HEAD),
114 \fBattributes\fR(5), \fBstandards\fR(5)