]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/sigwait.3
2f91f9a35e6c89ad9aca11af855346f28304a0b5
[thirdparty/man-pages.git] / man3 / sigwait.3
1 .\" Copyright (c) 2008, Linux Foundation, written by Michael Kerrisk
2 .\" <mtk.manpages@gmail.com>
3 .\"
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\"
6 .TH SIGWAIT 3 2021-03-22 "Linux man-pages (unreleased)" "Linux Programmer's Manual"
7 .SH NAME
8 sigwait \- wait for a signal
9 .SH LIBRARY
10 Standard C library
11 .RI ( libc ", " \-lc )
12 .SH SYNOPSIS
13 .nf
14 .B #include <signal.h>
15 .PP
16 .BI "int sigwait(const sigset_t *restrict " set ", int *restrict " sig );
17 .fi
18 .PP
19 .RS -4
20 Feature Test Macro Requirements for glibc (see
21 .BR feature_test_macros (7)):
22 .RE
23 .PP
24 .BR sigwait ():
25 .nf
26 Since glibc 2.26:
27 _POSIX_C_SOURCE >= 199506L
28 Glibc 2.25 and earlier:
29 _POSIX_C_SOURCE
30 .fi
31 .SH DESCRIPTION
32 The
33 .BR sigwait ()
34 function suspends execution of the calling thread until
35 one of the signals specified in the signal set
36 .I set
37 becomes pending.
38 The function accepts the signal
39 (removes it from the pending list of signals),
40 and returns the signal number in
41 .IR sig .
42 .PP
43 The operation of
44 .BR sigwait ()
45 is the same as
46 .BR sigwaitinfo (2),
47 except that:
48 .IP * 2
49 .BR sigwait ()
50 returns only the signal number, rather than a
51 .I siginfo_t
52 structure describing the signal.
53 .IP *
54 The return values of the two functions are different.
55 .SH RETURN VALUE
56 On success,
57 .BR sigwait ()
58 returns 0.
59 On error, it returns a positive error number (listed in ERRORS).
60 .SH ERRORS
61 .TP
62 .B EINVAL
63 .\" Does not occur for glibc.
64 .I set
65 contains an invalid signal number.
66 .SH ATTRIBUTES
67 For an explanation of the terms used in this section, see
68 .BR attributes (7).
69 .ad l
70 .nh
71 .TS
72 allbox;
73 lbx lb lb
74 l l l.
75 Interface Attribute Value
76 T{
77 .BR sigwait ()
78 T} Thread safety MT-Safe
79 .TE
80 .hy
81 .ad
82 .sp 1
83 .SH STANDARDS
84 POSIX.1-2001, POSIX.1-2008.
85 .SH NOTES
86 .BR sigwait ()
87 is implemented using
88 .BR sigtimedwait (2).
89 .PP
90 The glibc implementation of
91 .BR sigwait ()
92 silently ignores attempts to wait for the two real-time signals that
93 are used internally by the NPTL threading implementation.
94 See
95 .BR nptl (7)
96 for details.
97 .SH EXAMPLES
98 See
99 .BR pthread_sigmask (3).
100 .SH SEE ALSO
101 .BR sigaction (2),
102 .BR signalfd (2),
103 .BR sigpending (2),
104 .BR sigsuspend (2),
105 .BR sigwaitinfo (2),
106 .BR sigsetops (3),
107 .BR signal (7)