# sigevent

## NAME



           sigevent, sigval - structure for notification from asynchronous
           routines
    


## 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 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).
    
           The definition shown in the SYNOPSIS is approximate: some of the
           fields in the _sigevent_ structure may be defined as part of a
           union.  Programs should employ only those fields relevant to the
           value specified in _sigev_notify_.
    
           The _sigev_notify_ field specifies how notification is to be
           performed.  This field can have one of the following values:
    
           **SIGEV_NONE**
                  A "null" notification: don't do anything when the event
                  occurs.
    
           **SIGEV_SIGNAL**
                  Notify the process by sending the signal specified in
                  _sigev_signo_.
    
                  If the signal is caught with a signal handler that was
                  registered using the sigaction(2) **SA_SIGINFO** flag, then the
                  following fields are set in the _siginfo_t_ structure that is
                  passed as the second argument of the handler:
    
                  _si_code_
                         This field is set to a value that depends on the API
                         delivering the notification.
    
                  _si_signo_
                         This field is set to the signal number (i.e., the
                         same value as in _sigev_signo_).
    
                  _si_value_
                         This field is set to the value specified in
                         _sigev_value_.
    
                  Depending on the API, other fields may also be set in the
                  _siginfo_t_ structure.
    
                  The same information is also available if the signal is
                  accepted using sigwaitinfo(2).
    
           **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 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 _sigev_value_
                  as its sole argument.  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)).
    
           **SIGEV_THREAD_ID**(Linux-specific)
                  Currently used only by POSIX timers; see timer_create(2).
    
       **sigval**
           Data passed with a signal.
    


## STANDARDS



           POSIX.1-2008.
    


## NOTES



           The following headers also provide _sigevent_ : _< aio.h>_, _< mqueue.h>_,
           and _< time.h>_.
    


* * *