1SIGEVENT(7) Linux Programmer's Manual SIGEVENT(7)
2
3
4
6 sigevent - structure for notification from asynchronous routines
7
9 #include <signal.h>
10
11 union sigval { /* Data passed with notification */
12 int sival_int; /* Integer value */
13 void *sival_ptr; /* Pointer value */
14 };
15
16 struct sigevent {
17 int sigev_notify; /* Notification method */
18 int sigev_signo; /* Notification signal */
19 union sigval sigev_value; /* Data passed with
20 notification */
21 void (*sigev_notify_function) (union sigval);
22 /* Function used for thread
23 notification (SIGEV_THREAD) */
24 void *sigev_notify_attributes;
25 /* Attributes for notification thread
26 (SIGEV_THREAD) */
27 pid_t sigev_notify_thread_id;
28 /* ID of thread to signal (SIGEV_THREAD_ID) */
29 };
30
32 The sigevent structure is used by various APIs to describe the way a
33 process is to be notified about an event (e.g., completion of an asyn‐
34 chronous request, expiration of a timer, or the arrival of a message).
35
36 The definition shown in the SYNOPSIS is approximate: some of the fields
37 in the sigevent structure may be defined as part of a union. Programs
38 should employ only those fields relevant to the value specified in
39 sigev_notify.
40
41 The sigev_notify field specifies how notification is to be performed.
42 This field can have one of the following values:
43
44 SIGEV_NONE
45 A "null" notification: don't do anything when the event occurs.
46
47 SIGEV_SIGNAL
48 Notify the process by sending the signal specified in
49 sigev_signo.
50
51 If the signal is caught with a signal handler that was regis‐
52 tered using the sigaction(2) SA_SIGINFO flag, then the follow‐
53 ing fields are set in the siginfo_t structure that is passed as
54 the second argument of the handler:
55
56 si_code This field is set to a value that depends on the API
57 delivering the notification.
58
59 si_signo This field is set to the signal number (i.e., the
60 same value as in sigev_signo).
61
62 si_value This field is set to the value specified in
63 sigev_value.
64
65 Depending on the API, other fields may also be set in the sig‐
66 info_t structure.
67
68 The same information is also available if the signal is
69 accepted using sigwaitinfo(2).
70
71 SIGEV_THREAD
72 Notify the process by invoking sigev_notify_function "as if" it
73 were the start function of a new thread. (Among the implemen‐
74 tation possibilities here are that each timer notification
75 could result in the creation of a new thread, or that a single
76 thread is created to receive all notifications.) The function
77 is invoked with sigev_value as its sole argument. If
78 sigev_notify_attributes is not NULL, it should point to a
79 pthread_attr_t structure that defines attributes for the new
80 thread (see pthread_attr_init(3)).
81
82 SIGEV_THREAD_ID (Linux-specific)
83 Currently used only by POSIX timers; see timer_create(2).
84
86 timer_create(2), aio_fsync(3), aio_read(3), aio_write(3), getad‐
87 drinfo_a(3), lio_listio(3), mq_notify(3), aio(7), pthreads(7)
88
90 This page is part of release 4.15 of the Linux man-pages project. A
91 description of the project, information about reporting bugs, and the
92 latest version of this page, can be found at
93 https://www.kernel.org/doc/man-pages/.
94
95
96
97GNU 2017-07-13 SIGEVENT(7)