2 .\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk
3 .\" <mtk.manpages@gmail.com>
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
7 .TH pthread_attr_setsigmask_np 3 (date) "Linux man-pages (unreleased)"
9 pthread_attr_setsigmask_np, pthread_attr_getsigmask_np \- set/get
10 signal mask attribute in thread attributes object
13 .RI ( libpthread ", " \-lpthread )
16 .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
17 .B #include <pthread.h>
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 );
26 .BR pthread_attr_setsigmask_np ()
27 function sets the signal mask attribute of the
28 thread attributes object referred to by
30 to the value specified in
34 is specified as NULL, then any existing signal mask attribute in
39 .BR pthread_attr_getsigmask_np ()
40 function returns the signal mask attribute of the thread attributes object
43 in the buffer pointed to by
45 If the signal mask attribute is currently unset,
46 then this function returns the special value
47 .B PTHREAD_ATTR_NO_SIGMASK_NP
51 .BR pthread_attr_setsigmask_np ()
52 function returns 0 on success, or a nonzero error number on failure.
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
61 .B PTHREAD_ATTR_NO_SIGMASK_NP
62 indicates that the signal mask attribute is not set in
65 On error, these functions return a positive error number.
69 .RB ( pthread_attr_setsigmask_np ())
70 Could not allocate memory.
72 These functions are provided since glibc 2.32.
74 For an explanation of the terms used in this section, see
82 Interface Attribute Value
84 .BR pthread_attr_setsigmask_np (),
85 .BR pthread_attr_getsigmask_np ()
86 T} Thread safety MT-Safe
92 These functions are nonstandard GNU extensions;
93 hence the suffix "_np" (nonportable) in the names.
95 The signal mask attribute determines the signal mask that will be assigned to
96 a thread created using the thread attributes object
98 If this attribute is not set, then a thread created using
100 will inherit a copy of the creating thread's signal mask.
102 For more details on signal masks, see
104 For a description of a set of macros
105 that can be used to manipulate and inspect signal sets, see
109 .BR pthread_attr_setsigmask_np ()
110 it is possible to create a thread with a desired signal mask as follows:
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.
116 The new thread is then created using
117 .BR pthread_create ();
118 the new thread will inherit the creating thread's signal mask.
120 The new thread sets its signal mask to the desired value using
121 .BR pthread_sigmask (3).
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.
130 .BR pthread_attr_init (3),
131 .BR pthread_sigmask (3),