# sigevent(7) - man - phpMan

[SIGEVENT(7)](https://www.chedong.com/phpMan.php/man/SIGEVENT/7/markdown)                           Linux Programmer's Manual                          [SIGEVENT(7)](https://www.chedong.com/phpMan.php/man/SIGEVENT/7/markdown)



## NAME
       sigevent - structure for notification from asynchronous routines

## SYNOPSIS
       #include <signal.h>

       union sigval {            /* Data passed with notification */
           int     sival_int;    /* Integer value */
           void   *sival_ptr;    /* Pointer value */
       };

       struct sigevent {
           int    sigev_notify;  /* Notification method */
           int    sigev_signo;   /* Notification signal */
           union sigval sigev_value;
                                 /* Data passed with notification */
           void (*sigev_notify_function) (union sigval);
                                 /* Function used for thread
                                    notification (SIGEV_THREAD) */
           void  *sigev_notify_attributes;
                                 /* Attributes for notification thread
                                    (SIGEV_THREAD) */
           pid_t  sigev_notify_thread_id;
                                 /* ID of thread to signal
                                    (SIGEV_THREAD_ID); Linux-specific */
       };

## DESCRIPTION
       The  _sigevent_  structure is used by various APIs to describe the way a process is to be noti‐
       fied 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  rele‐
       vant 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  **sigac**‐‐
              [**tion**(2)](https://www.chedong.com/phpMan.php/man/tion/2/markdown)  **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  notifi‐
                        cation.

              _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)](https://www.chedong.com/phpMan.php/man/sigwaitinfo/2/markdown).

       **SIGEV**___**THREAD**
              Notify the process by invoking _sigev_notify_function_ "as if" it were the  start  func‐
              tion  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)](https://www.chedong.com/phpMan.php/man/init/3/markdown)).

       **SIGEV**___**THREAD**___**ID** (Linux-specific)
              Currently used only by POSIX timers; see **timer**___**[create**(2)](https://www.chedong.com/phpMan.php/man/create/2/markdown).

## SEE ALSO
       **timer**___**[create**(2)](https://www.chedong.com/phpMan.php/man/create/2/markdown), **aio**___**[fsync**(3)](https://www.chedong.com/phpMan.php/man/fsync/3/markdown), **aio**___**[read**(3)](https://www.chedong.com/phpMan.php/man/read/3/markdown),  **aio**___**[write**(3)](https://www.chedong.com/phpMan.php/man/write/3/markdown),  **getaddrinfo**___**[a**(3)](https://www.chedong.com/phpMan.php/man/a/3/markdown),  **lio**___**[listio**(3)](https://www.chedong.com/phpMan.php/man/listio/3/markdown),
       **mq**___**[notify**(3)](https://www.chedong.com/phpMan.php/man/notify/3/markdown), [**aio**(7)](https://www.chedong.com/phpMan.php/man/aio/7/markdown), [**pthreads**(7)](https://www.chedong.com/phpMan.php/man/pthreads/7/markdown)

## COLOPHON
       This  page  is  part  of  release  5.10 of the Linux _man-pages_ project.  A description of the
       project, information about reporting bugs, and the latest version of this page, can be  found
       at <https://www.kernel.org/doc/man-pages/>.



GNU                                          2020-11-01                                  [SIGEVENT(7)](https://www.chedong.com/phpMan.php/man/SIGEVENT/7/markdown)
