1SIGWAITINFO(2)             Linux Programmer's Manual            SIGWAITINFO(2)
2
3
4

NAME

6       sigwaitinfo, sigtimedwait - synchronously wait for queued signals
7

SYNOPSIS

9       #include <signal.h>
10
11       int sigwaitinfo(const sigset_t *set, siginfo_t *info);
12
13       int sigtimedwait(const sigset_t *set, siginfo_t *info,
14                        const struct timespec *timeout);
15
16   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
17
18       sigwaitinfo(), sigtimedwait(): _POSIX_C_SOURCE >= 199309L
19

DESCRIPTION

21       sigwaitinfo() suspends execution of the calling thread until one of the
22       signals in set is delivered.  (If one of the signals in set is  already
23       pending  for  the calling thread, sigwaitinfo() will return immediately
24       with information about that signal.)
25
26       sigwaitinfo() removes the delivered signal from the set of pending sig‐
27       nals and returns the signal number as its function result.  If the info
28       argument is not NULL, then it returns a  structure  of  type  siginfo_t
29       (see sigaction(2)) containing information about the signal.
30
31       Signals  returned  via  sigwaitinfo() are delivered in the usual order;
32       see signal(7) for further details.
33
34       sigtimedwait() operates in exactly the same way as sigwaitinfo() except
35       that  it  has  an  additional argument, timeout, which enables an upper
36       bound to be placed on the time for which the thread is suspended.  This
37       argument is of the following type:
38
39           struct timespec {
40               long    tv_sec;         /* seconds */
41               long    tv_nsec;        /* nanoseconds */
42           }
43
44       If  both  fields  of  this structure are specified as 0, a poll is per‐
45       formed: sigtimedwait() returns  immediately,  either  with  information
46       about  a  signal  that  was pending for the caller, or with an error if
47       none of the signals in set was pending.
48

RETURN VALUE

50       On success, both sigwaitinfo() and sigtimedwait() return a signal  num‐
51       ber  (i.e.,  a  value greater than zero).  On failure both calls return
52       -1, with errno set to indicate the error.
53

ERRORS

55       EAGAIN No signal in set was delivered within the timeout period  speci‐
56              fied to sigtimedwait().
57
58       EINTR  The  wait  was  interrupted  by a signal handler; see signal(7).
59              (This handler was for a signal other than one of those in set.)
60
61       EINVAL timeout was invalid.
62

CONFORMING TO

64       POSIX.1-2001.
65

NOTES

67       In normal usage, the calling program blocks the signals in  set  via  a
68       prior call to sigprocmask(2) (so that the default disposition for these
69       signals does not occur if they are delivered between  successive  calls
70       to sigwaitinfo() or sigtimedwait()) and does not establish handlers for
71       these signals.  In  a  multithreaded  program,  the  signal  should  be
72       blocked  in  all  threads  to  prevent  the signal being delivered to a
73       thread other than the one calling sigwaitinfo() or sigtimedwait()).
74
75       The set of signals that is pending for a given thread is the  union  of
76       the set of signals that is pending specifically for that thread and the
77       set of signals that is pending for the process as  a  whole  (see  sig‐
78       nal(7)).
79
80       If  multiple threads of a process are blocked waiting for the same sig‐
81       nal(s) in sigwaitinfo() or sigtimedwait(),  then  exactly  one  of  the
82       threads  will  actually  receive  the  signal if it is delivered to the
83       process as a whole; which of the threads receives the signal  is  inde‐
84       terminate.
85
86       POSIX  leaves  the  meaning of a NULL value for the timeout argument of
87       sigtimedwait() unspecified, permitting the possibility  that  this  has
88       the same meaning as a call to sigwaitinfo(), and indeed this is what is
89       done on Linux.
90
91       On Linux, sigwaitinfo() is a library function  implemented  on  top  of
92       sigtimedwait().
93

SEE ALSO

95       kill(2),  sigaction(2), signal(2), signalfd(2), sigpending(2), sigproc‐
96       mask(2), sigqueue(2), sigsetops(3), sigwait(3), signal(7), time(7)
97

COLOPHON

99       This page is part of release 3.22 of the Linux  man-pages  project.   A
100       description  of  the project, and information about reporting bugs, can
101       be found at http://www.kernel.org/doc/man-pages/.
102
103
104
105Linux                             2008-10-04                    SIGWAITINFO(2)
Impressum