.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
-.TH MQ_NOTIFY 3 2010-10-04 "Linux" "Linux Programmer's Manual"
+.TH MQ_NOTIFY 3 2014-04-06 "Linux" "Linux Programmer's Manual"
.SH NAME
mq_notify \- register for notification when a message is available
.SH SYNOPSIS
.PP
If
.I sevp
-is a non-NULL pointer, then
+is a non-null pointer, then
.BR mq_notify ()
registers the calling process to receive message notification.
The
Notification is performed by creating a thread.
The thread executes a function which reads one message from the
queue and then terminates the process.
+.SS Program source
.nf
-
#include <pthread.h>
#include <mqueue.h>
#include <stdio.h>
if (nr == \-1)
handle_error("mq_receive");
- printf("Read %ld bytes from MQ\\n", (long) nr);
+ printf("Read %zd bytes from MQ\\n", nr);
free(buf);
exit(EXIT_SUCCESS); /* Terminate the process */
}
struct sigevent sev;
if (argc != 2) {
- fprintf(stderr, "Usage: %s <mq\-name>\\n", argv[0]);
- exit(EXIT_FAILURE);
+ fprintf(stderr, "Usage: %s <mq\-name>\\n", argv[0]);
+ exit(EXIT_FAILURE);
}
mqdes = mq_open(argv[1], O_RDONLY);
.BR mq_unlink (3),
.BR mq_overview (7),
.BR sigevent (7)
+.SH COLOPHON
+This page is part of release 3.68 of the Linux
+.I man-pages
+project.
+A description of the project,
+information about reporting bugs,
+and the latest version of this page,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.