SIGEVENT(3)
π¦ SIGEVENT(3) β asynchronous event notification, from the Library Functions Manual π¦
β¨ NAME β¨
sigevent β asynchronous event notification. that's the name, bestie, and it's iconic. π
π SYNOPSIS π
the one include you need:
#include <signal.h>
π DESCRIPTION π
okay so some operations permit threads to request asynchronous notification of events via a struct sigevent structure. this structure contains several fields that describe the requested notification β and the way that this struct lays out its fields? obsessed. no cap, every single one matters:
intsigev_notifyβ notification methodintsigev_signoβ signal numberunion sigvalsigev_valueβ signal valueintsigev_notify_kqueueβkqueue(2)file descriptorunsigned shortsigev_notify_kevent_flagsβ kevent flagslwpid_tsigev_notify_thread_idβ LWP IDvoid (*)(union sigval)sigev_notify_functionβ callback function pointerpthread_attr_t *sigev_notify_attributesβ callback thread attributes
the sigev_notify field specifies the notification method used when the event triggers: lowkey choose your fighter π
SIGEV_NONEβ no notification is sent. literally ghost mode, not me sending nothing. π»SIGEV_SIGNALβ the signalsigev_signois queued as a real-time signal to the calling process. the value stored insigev_valuewill be present in thesi_valueof thesiginfo_tstructure of the queued signal. signal delivery said hi. π¬SIGEV_THREADβ the notification function insigev_notify_functionis called in a separate thread context. the thread is created with the attributes specified in*sigev_notify_attributes. the value stored insigev_valueis passed as the sole argument tosigev_notify_function. ifsigev_notify_attributesisNULL, the thread is created with default attributes. thread behavior, slay. π§΅SIGEV_KEVENTβ a newkeventis posted to thekqueuesigev_notify_kqueue. theudatamember of thekeventstructure contains the value stored insigev_value. the meaning of other fields in thekeventare specific to the type of triggered event. kqueue girlies rise. πSIGEV_THREAD_IDβ the signalsigev_signois queued to the thread whose LWP ID issigev_notify_thread_id. the value stored insigev_valuewill be present in thesi_valueof thesiginfo_tstructure of the queued signal. specific-thread delivery, periodt. π―
π¨ NOTES π¨
note note note: programs wishing to useSIGEV_THREADnotifications must link against the POSIX Real-time Library (librt,-lrt). do not forget the link, bestie β iykyk. π
π SEE ALSO π
go peek at aio_read(2), mq_notify(2), timer_create(2), and siginfo(3). the whole friend group. π«Ά
π STANDARDS π
the struct sigevent type conforms to IEEE Std 1003.1-2004 (βPOSIX.1β). standardized and stunning. β¨
π¦ HISTORY π¦
the sigevent structure first appeared in FreeBSD 3.3. that's the origin story, fr fr. π
π and that's the page, bestie β it's from Debian, dated February 25, 2020, and it's the SIGEVENT(3) page. mwah! π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 2016 John H. Baldwin <jhb@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms