man-pages/man7/sigevent.7.html
2021-03-31 01:06:50 +01:00

204 lines
5.4 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of SIGEVENT</TITLE>
</HEAD><BODY>
<H1>SIGEVENT</H1>
Section: Linux Programmer's Manual (7)<BR>Updated: 2017-07-13<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
sigevent - structure for notification from asynchronous routines
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<PRE>
#include &lt;<A HREF="file:///usr/include/signal.h">signal.h</A>&gt;
union sigval { /* Data passed with notification */
int sival_int; /* Integer value */
void *sival_ptr; /* Pointer value */
};
struct sigevent {
int sigev_notify; /* Notification method */
int sigev_signo; /* Notification signal */
union sigval sigev_value; /* Data passed with
notification */
void (*sigev_notify_function) (union sigval);
/* Function used for thread
notification (SIGEV_THREAD) */
void *sigev_notify_attributes;
/* Attributes for notification thread
(SIGEV_THREAD) */
pid_t sigev_notify_thread_id;
/* ID of thread to signal (SIGEV_THREAD_ID) */
};
</PRE>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<P>
The
<I>sigevent</I>
structure is used by various APIs
to describe the way a process is to be notified about an event
(e.g., completion of an asynchronous request, expiration of a timer,
or the arrival of a message).
<P>
The definition shown in the SYNOPSIS is approximate:
some of the fields in the
<I>sigevent</I>
structure may be defined as part of a union.
Programs should employ only those fields relevant
to the value specified in
<I>sigev_notify</I>.
<P>
The
<I>sigev_notify</I>
field specifies how notification is to be performed.
This field can have one of the following values:
<DL COMPACT>
<DT id="1"><B>SIGEV_NONE</B>
<DD>
A &quot;null&quot; notification: don't do anything when the event occurs.
<DT id="2"><B>SIGEV_SIGNAL</B>
<DD>
Notify the process by sending the signal specified in
<I>sigev_signo</I>.
<DT id="3"><DD>
If the signal is caught with a signal handler that was registered using the
<B><A HREF="/cgi-bin/man/man2html?2+sigaction">sigaction</A></B>(2)
<B>SA_SIGINFO</B>
flag, then the following fields are set in the
<I>siginfo_t</I>
structure that is passed as the second argument of the handler:
<DL COMPACT><DT id="4"><DD>
<DL COMPACT>
<DT id="5"><I>si_code</I>
<DD>
This field is set to a value that depends on the API
delivering the notification.
<DT id="6"><I>si_signo</I>
<DD>
This field is set to the signal number (i.e., the same value as in
<I>sigev_signo</I>).
<DT id="7"><I>si_value</I>
<DD>
This field is set to the value specified in
<I>sigev_value</I>.
</DL>
</DL>
<DT id="8"><DD>
Depending on the API, other fields may also be set in the
<I>siginfo_t</I>
structure.
<DT id="9"><DD>
The same information is also available if the signal is accepted using
<B><A HREF="/cgi-bin/man/man2html?2+sigwaitinfo">sigwaitinfo</A></B>(2).
<DT id="10"><B>SIGEV_THREAD</B>
<DD>
Notify the process by invoking
<I>sigev_notify_function</I>
&quot;as if&quot; it were the start function of a new thread.
(Among the implementation possibilities here are that
each timer notification could result in the creation of a new thread,
or that a single thread is created to receive all notifications.)
The function is invoked with
<I>sigev_value</I>
as its sole argument.
If
<I>sigev_notify_attributes</I>
is not NULL, it should point to a
<I>pthread_attr_t</I>
structure that defines attributes for the new thread (see
<B><A HREF="/cgi-bin/man/man2html?3+pthread_attr_init">pthread_attr_init</A></B>(3)).
<DT id="11"><B>SIGEV_THREAD_ID</B> (Linux-specific)
<DD>
Currently used only by POSIX timers; see
<B><A HREF="/cgi-bin/man/man2html?2+timer_create">timer_create</A></B>(2).
</DL>
<A NAME="lbAE">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?2+timer_create">timer_create</A></B>(2),
<B><A HREF="/cgi-bin/man/man2html?3+aio_fsync">aio_fsync</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+aio_read">aio_read</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+aio_write">aio_write</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+getaddrinfo_a">getaddrinfo_a</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+lio_listio">lio_listio</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+mq_notify">mq_notify</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?7+aio">aio</A></B>(7),
<B><A HREF="/cgi-bin/man/man2html?7+pthreads">pthreads</A></B>(7)
<A NAME="lbAF">&nbsp;</A>
<H2>COLOPHON</H2>
This page is part of release 5.05 of the Linux
<I>man-pages</I>
project.
A description of the project,
information about reporting bugs,
and the latest version of this page,
can be found at
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="12"><A HREF="#lbAB">NAME</A><DD>
<DT id="13"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="14"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="15"><A HREF="#lbAE">SEE ALSO</A><DD>
<DT id="16"><A HREF="#lbAF">COLOPHON</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:06:09 GMT, March 31, 2021
</BODY>
</HTML>