1 .\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk
2 .\" <mtk.manpages@gmail.com>
4 .\" %%%LICENSE_START(VERBATIM)
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date. The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein. The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
26 .TH PTHREAD_ATTR_SETSIGMASK_NP 3 2021-03-22 "Linux" "Linux Programmer's Manual"
28 pthread_attr_setsigmask_np, pthread_attr_getsigmask_np \- set/get
29 signal mask attribute in thread attributes object
32 .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
33 .B #include <pthread.h>
35 .BI "int pthread_attr_setsigmask_np(pthread_attr_t *" attr ,
36 .BI " const sigset_t *" sigmask );
37 .BI "int pthread_attr_getsigmask_np(const pthread_attr_t *" attr ,
38 .BI " sigset_t *" sigmask );
40 Compile and link with \fI\-pthread\fP.
44 .BR pthread_attr_setsigmask_np ()
45 function sets the signal mask attribute of the
46 thread attributes object referred to by
48 to the value specified in
52 is specified as NULL, then any existing signal mask attribute in
57 .BR pthread_attr_getsigmask_np ()
58 function returns the signal mask attribute of the thread attributes object
61 in the buffer pointed to by
63 If the signal mask attribute is currently unset,
64 then this function returns the special value
65 .B PTHREAD_ATTR_NO_SIGMASK_NP
69 .BR pthread_attr_setsigmask_np ()
70 function returns 0 on success, or a nonzero error number on failure.
73 .BR pthread_attr_getsigmask_np ()
74 function returns either 0 or
75 .BR PTHREAD_ATTR_NO_SIGMASK_NP .
76 When 0 is returned, the signal mask attribute is returned via
79 .B PTHREAD_ATTR_NO_SIGMASK_NP
80 indicates that the signal mask attribute is not set in
83 On error, these functions return a positive error number.
87 .RB ( pthread_attr_setsigmask_np ())
88 Could not allocate memory.
90 These functions are provided by glibc since version 2.32.
92 For an explanation of the terms used in this section, see
100 Interface Attribute Value
102 .BR pthread_attr_setsigmask_np (),
103 .BR pthread_attr_getsigmask_np ()
104 T} Thread safety MT-Safe
110 These functions are nonstandard GNU extensions;
111 hence the suffix "_np" (nonportable) in the names.
113 The signal mask attribute determines the signal mask that will be assigned to
114 a thread created using the thread attributes object
116 If this attribute is not set, then a thread created using
118 will inherit a copy of the creating thread's signal mask.
120 For more details on signal masks, see
122 For a description of a set of macros
123 that can be used to manipulate and inspect signal sets, see
127 .BR pthread_attr_setsigmask_np ()
128 it is possible to create a thread with a desired signal mask as follows:
130 The creating thread uses
131 .BR pthread_sigmask (3)
132 to save its current signal mask and set its mask to block all signals.
134 The new thread is then created using
135 .BR pthread_create ();
136 the new thread will inherit the creating thread's signal mask.
138 The new thread sets its signal mask to the desired value using
139 .BR pthread_sigmask (3).
141 The creating thread restores its signal mask to the original value.
143 Following the above steps,
144 there is no possibility for the new thread to receive a signal
145 before it has adjusted its signal mask to the desired value.
148 .BR pthread_attr_init (3),
149 .BR pthread_sigmask (3),