tzfile.5, tzselect.8: sync from tzdb upstream
[man-pages.git] / man3 / pthread_attr_setsigmask_np.3
blobff9b0355ba33d322e978f3512bddb0f487d7992b
1 '\" t
2 .\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk
3 .\"     <mtk.manpages@gmail.com>
4 .\"
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\"
7 .TH pthread_attr_setsigmask_np 3 (date) "Linux man-pages (unreleased)"
8 .SH NAME
9 pthread_attr_setsigmask_np, pthread_attr_getsigmask_np \- set/get
10 signal mask attribute in thread attributes object
11 .SH LIBRARY
12 POSIX threads library
13 .RI ( libpthread ", " \-lpthread )
14 .SH SYNOPSIS
15 .nf
16 .BR "#define _GNU_SOURCE" "             /* See feature_test_macros(7) */"
17 .B #include <pthread.h>
18 .PP
19 .BI "int pthread_attr_setsigmask_np(pthread_attr_t *" attr ,
20 .BI "                               const sigset_t *" sigmask );
21 .BI "int pthread_attr_getsigmask_np(const pthread_attr_t *" attr ,
22 .BI "                               sigset_t *" sigmask );
23 .fi
24 .SH DESCRIPTION
25 The
26 .BR pthread_attr_setsigmask_np ()
27 function sets the signal mask attribute of the
28 thread attributes object referred to by
29 .I attr
30 to the value specified in
31 .IR *sigmask .
33 .I sigmask
34 is specified as NULL, then any existing signal mask attribute in
35 .I attr
36 is unset.
37 .PP
38 The
39 .BR pthread_attr_getsigmask_np ()
40 function returns the signal mask attribute of the thread attributes object
41 referred to by
42 .I attr
43 in the buffer pointed to by
44 .IR sigmask .
45 If the signal mask attribute is currently unset,
46 then this function returns the special value
47 .B PTHREAD_ATTR_NO_SIGMASK_NP
48 as its result.
49 .SH RETURN VALUE
50 The
51 .BR pthread_attr_setsigmask_np ()
52 function returns 0 on success, or a nonzero error number on failure.
53 .PP
54 the
55 .BR pthread_attr_getsigmask_np ()
56 function returns either 0 or
57 .BR PTHREAD_ATTR_NO_SIGMASK_NP .
58 When 0 is returned, the signal mask attribute is returned via
59 .IR sigmask .
60 A return value of
61 .B PTHREAD_ATTR_NO_SIGMASK_NP
62 indicates that the signal mask attribute is not set in
63 .IR attr .
64 .PP
65 On error, these functions return a positive error number.
66 .SH ERRORS
67 .TP
68 .B ENOMEM
69 .RB ( pthread_attr_setsigmask_np ())
70 Could not allocate memory.
71 .SH VERSIONS
72 These functions are provided since glibc 2.32.
73 .SH ATTRIBUTES
74 For an explanation of the terms used in this section, see
75 .BR attributes (7).
76 .ad l
77 .nh
78 .TS
79 allbox;
80 lbx lb lb
81 l l l.
82 Interface       Attribute       Value
84 .BR pthread_attr_setsigmask_np (),
85 .BR pthread_attr_getsigmask_np ()
86 T}      Thread safety   MT-Safe
87 .TE
88 .hy
89 .ad
90 .sp 1
91 .SH STANDARDS
92 These functions are nonstandard GNU extensions;
93 hence the suffix "_np" (nonportable) in the names.
94 .SH NOTES
95 The signal mask attribute determines the signal mask that will be assigned to
96 a thread created using the thread attributes object
97 .IR attr .
98 If this attribute is not set, then a thread created using
99 .I attr
100 will inherit a copy of the creating thread's signal mask.
102 For more details on signal masks, see
103 .BR sigprocmask (2).
104 For a description of a set of macros
105 that can be used to manipulate and inspect signal sets, see
106 .BR sigsetops (3).
108 In the absence of
109 .BR pthread_attr_setsigmask_np ()
110 it is possible to create a thread with a desired signal mask as follows:
111 .IP \[bu] 3
112 The creating thread uses
113 .BR pthread_sigmask (3)
114 to save its current signal mask and set its mask to block all signals.
115 .IP \[bu]
116 The new thread is then created using
117 .BR pthread_create ();
118 the new thread will inherit the creating thread's signal mask.
119 .IP \[bu]
120 The new thread sets its signal mask to the desired value using
121 .BR pthread_sigmask (3).
122 .IP \[bu]
123 The creating thread restores its signal mask to the original value.
125 Following the above steps,
126 there is no possibility for the new thread to receive a signal
127 before it has adjusted its signal mask to the desired value.
128 .SH SEE ALSO
129 .BR sigprocmask (2),
130 .BR pthread_attr_init (3),
131 .BR pthread_sigmask (3),
132 .BR pthreads (7),
133 .BR signal (7)