xref: /dragonfly/lib/librt/mq_notify.2 (revision 91dc43dd)
1.\"	$NetBSD: mq_notify.3,v 1.1 2009/01/05 21:19:49 rmind Exp $
2.\"
3.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved
4.\"
5.Dd August 19, 2009
6.Dt MQ_NOTIFY 2
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_close 2 ,
71.Xr mq_getattr 2 ,
72.Xr mq_open 2 ,
73.Xr mq_receive 2 ,
74.Xr mq_send 2 ,
75.Xr mq_setattr 2 ,
76.Xr mq_unlink 2
77.Sh STANDARDS
78This function conforms to the
79.St -p1003.1-2001
80standard.
81.Sh HISTORY
82This function first appeared in
83.Dx 2.5 .
84.Sh COPYRIGHT
85Portions of this text are reprinted and reproduced in electronic form
86from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
87-- Portable Operating System Interface (POSIX), The Open Group Base
88Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
89Electrical and Electronics Engineers, Inc and The Open Group.
90In the
91event of any discrepancy between this version and the original IEEE and
92The Open Group Standard, the original IEEE and The Open Group Standard
93is the referee document.
94The original Standard can be obtained online at
95http://www.opengroup.org/unix/online.html .
96