xref: /netbsd/lib/librt/mq_notify.3 (revision 6550d01e)
1.\"	$NetBSD: mq_notify.3,v 1.2 2010/06/07 07:21:52 jruoho Exp $
2.\"
3.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved
4.\"
5.Dd June 7, 2010
6.Dt MQ_NOTIFY 3
7.Os
8.Sh NAME
9.Nm mq_notify
10.Nd notify process that a message is available (REALTIME)
11.Sh LIBRARY
12.Lb librt
13.Sh SYNOPSIS
14.In mqueue.h
15.Ft int
16.Fn mq_notify "mqd_t mqdes" "const struct sigevent *notification"
17.Sh DESCRIPTION
18If the argument
19.Fa notification
20is not
21.Dv NULL ,
22this function will register the calling process to be notified of
23message arrival at an empty message queue associated with the
24specified message queue descriptor,
25.Fa mqdes .
26The notification specified by the
27.Fa notification
28argument will be sent to the process when the message queue
29transitions from empty to non-empty.
30At any time, only one process may be registered for notification
31by a message queue.
32If the calling process or any other process has already registered
33for notification of message arrival at the specified message queue,
34subsequent attempts to register for that message queue fails.
35.Pp
36If
37.Fa notification
38is
39.Dv NULL
40and the process is currently registered for notification by the
41specified message queue, the existing registration will be removed.
42.Pp
43When the notification is sent to the registered process,
44its registration will be removed.
45The message queue will then be available for registration.
46.Pp
47If a process has registered for notification of message arrival
48at a message queue and some thread is blocked in
49.Fn mq_receive
50waiting to receive a message when a message arrives at the queue,
51the arriving message will satisfy the appropriate
52.Fn mq_receive .
53The resulting behavior is as if the message queue remains empty,
54and no notification will be sent.
55.Sh RETURN VALUES
56.Rv -std mq_notify
57.Sh ERRORS
58The
59.Fn mq_notify
60function fails if:
61.Bl -tag -width Er
62.It Bq Er EBADF
63The
64.Fa mqdes
65argument is not a valid message queue descriptor.
66.It Bq Er EBUSY
67A process is already registered for notification by the message queue.
68.El
69.Sh SEE ALSO
70.Xr mq 3 ,
71.Xr sigevent 3
72.Sh STANDARDS
73This function conforms to the
74.St -p1003.1-2001
75standard.
76.Sh HISTORY
77This function first appeared in
78.Nx 5.0 .
79.Sh COPYRIGHT
80Portions of this text are reprinted and reproduced in electronic form
81from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
82-- Portable Operating System Interface (POSIX), The Open Group Base
83Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
84Electrical and Electronics Engineers, Inc and The Open Group.
85In the
86event of any discrepancy between this version and the original IEEE and
87The Open Group Standard, the original IEEE and The Open Group Standard
88is the referee document.
89The original Standard can be obtained online at
90http://www.opengroup.org/unix/online.html .
91