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