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 in sigev_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 in sigev_signo.
  • si_value โ€” set to the value specified in sigev_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 invoking sigev_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 with sigev_value as its sole argument. and if sigev_notify_attributes is not NULL, it should point to a pthread_attr_t structure that defines attributes for the new thread โ€” see pthread_attr_init(3). main character thread energy fr fr. โœจ
  • SIGEV_THREAD_ID (Linux-specific) โ€” currently used only by POSIX timers; see timer_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
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms