sigevent(3type)
โจ sigevent โ the bestie notification glow-up โจ
okay so this is sigevent, a 3type page, and honestly? it's the blueprint for how async stuff tells you it's done. plus its little sidekick sigval, which is literally just "the data that rides along with the notification". no cap. ๐
๐ NAME ๐
sigevent, sigval โ the structs that asynchronous routines use to say "hey bestie, something happened" ๐ฃ
๐ธ SYNOPSIS ๐ธ
#include <signal.h>
struct sigevent {
int sigev_notify; /* Notification type */
int sigev_signo; /* Signal number */
union sigval sigev_value; /* Data passed with notification */
typeof(void (union sigval)) *sigev_notify_function;
/* Notification function
(SIGEV_THREAD) */
pthread_attr_t *sigev_notify_attributes;
/* Notification attributes */
/* Linux only: */
pid_t sigev_notify_thread_id;
/* ID of thread to signal
(SIGEV_THREAD_ID) */
};
union sigval { /* Data passed with notification */
int sival_int; /* Integer value */
void *sival_ptr; /* Pointer value */
};
๐ฆ DESCRIPTION ๐ฆ
sigevent ๐
the sigevent structure is what a bunch of APIs use to describe how a process wants to be notified about an event โ like an async request finishing, a timer expiring, or a message pulling up. it's giving "here's my contact preferences, respect them". ๐ฒ
the definition in the SYNOPSIS is approximate, bestie: some of the fields in sigevent might be defined as part of a union. so programs should only ever use the fields that are relevant to whatever value is sitting in sigev_notify. don't go touching fields that aren't yours, that's not the vibe. ๐
the sigev_notify field says how the notification happens. it can be one of these:
SIGEV_NONEโ a "null" notification. literally nothing happens when the event occurs. it's the "seen at 3:47am, no reply" of notifications. ๐SIGEV_SIGNALโ notify the process by sending the signal specified insigev_signo.
now if that signal gets caught by a signal handler registered with sigaction(2)'s SA_SIGINFO flag, then these fields get set in the siginfo_t structure that's passed as the handler's second argument:
si_codeโ set to a value that depends on the API delivering the notification.si_signoโ set to the signal number, i.e. the same value as insigev_signo.si_valueโ set to the value specified insigev_value.
depending on the API, other fields may also be set in the siginfo_t structure. so peek responsibly. ๐
the exact same information is also available if the signal gets accepted using sigwaitinfo(2). icons supporting icons. ๐ค
SIGEV_THREADโ notify the process by invokingsigev_notify_function"as if" it were the start function of a new thread. (among the implementation possibilities here: each timer notification could result in the creation of a new thread, or a single thread is created to receive all notifications. both are valid, don't come for them.) the function is invoked withsigev_valueas its sole argument. and ifsigev_notify_attributesis notNULL, it should point to apthread_attr_tstructure that defines attributes for the new thread โ seepthread_attr_init(3). main character thread energy fr fr. โจSIGEV_THREAD_ID(Linux-specific) โ currently used only by POSIX timers; seetimer_create(2).
sigval ๐
data passed with a signal. that's it, that's the whole thing. tiny but mighty. ๐
๐ STANDARDS ๐
POSIX.1-2024.
๐ฐ๏ธ HISTORY ๐ฐ๏ธ
POSIX.1-1996.
<aio.h> and <time.h> have defined sigevent since POSIX.1-2008. glow-up era. ๐
๐ NOTES ๐
these headers also provide sigevent: <aio.h>, <mqueue.h>, and <time.h>. so if you can't find it, it's probably just chillin' in one of those. ๐ง
๐ SEE ALSO ๐
timer_create(2), getaddrinfo_a(3), lio_listio(3), mq_notify(3), pthread_sigqueue(3), sigqueue(3), aiocb(3type), siginfo_t(3type)
ngl this page is from Linux man-pages 6.20, dated 2026-02-08 โ so when you cite your sources, cite those. periodt. ๐๐ซถ
stay notified, bestie!! ๐โจ๐๐ฆ๐ธ๐
๐ฆ where this page comes from
- arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- ๐ the page's license: Linux-man-pages-copyleft
- Copyright 2006-2020, Michael Kerrisk <mtk.manpages@gmail.com>
- Copyright 2009, Petr Baudis <pasky@ucw.cz>
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms