OSDN Git Service

LDP: Update POT and ja.po to LDP v3.78-git-80a7408
[linuxjm/LDP_man-pages.git] / po4a / pthread / po / pthread.pot
1 # SOME DESCRIPTIVE TITLE
2 # Copyright (C) YEAR Free Software Foundation, Inc.
3 # This file is distributed under the same license as the PACKAGE package.
4 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5 #
6 #, fuzzy
7 msgid ""
8 msgstr ""
9 "Project-Id-Version: PACKAGE VERSION\n"
10 "POT-Creation-Date: 2015-01-21 20:35+0900\n"
11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <LL@li.org>\n"
14 "Language: \n"
15 "MIME-Version: 1.0\n"
16 "Content-Type: text/plain; charset=UTF-8\n"
17 "Content-Transfer-Encoding: 8bit\n"
18
19 #. type: TH
20 #: build/C/man3/getcontext.3:25
21 #, no-wrap
22 msgid "GETCONTEXT"
23 msgstr ""
24
25 #. type: TH
26 #: build/C/man3/getcontext.3:25
27 #, no-wrap
28 msgid "2014-04-08"
29 msgstr ""
30
31 #. type: TH
32 #: build/C/man3/getcontext.3:25 build/C/man3/pthread_attr_init.3:26 build/C/man3/pthread_attr_setaffinity_np.3:26 build/C/man3/pthread_attr_setdetachstate.3:26 build/C/man3/pthread_attr_setguardsize.3:26 build/C/man3/pthread_attr_setinheritsched.3:26 build/C/man3/pthread_attr_setschedparam.3:26 build/C/man3/pthread_attr_setschedpolicy.3:26 build/C/man3/pthread_attr_setscope.3:26 build/C/man3/pthread_attr_setstack.3:26 build/C/man3/pthread_attr_setstackaddr.3:26 build/C/man3/pthread_attr_setstacksize.3:26 build/C/man3/pthread_cancel.3:26 build/C/man3/pthread_cleanup_push.3:26 build/C/man3/pthread_cleanup_push_defer_np.3:26 build/C/man3/pthread_create.3:26 build/C/man3/pthread_detach.3:26 build/C/man3/pthread_equal.3:26 build/C/man3/pthread_exit.3:26 build/C/man3/pthread_getattr_np.3:26 build/C/man3/pthread_getcpuclockid.3:26 build/C/man3/pthread_join.3:26 build/C/man3/pthread_kill.3:26 build/C/man3/pthread_kill_other_threads_np.3:26 build/C/man3/pthread_self.3:26 build/C/man3/pthread_setaffinity_np.3:26 build/C/man3/pthread_setcancelstate.3:26 build/C/man3/pthread_setconcurrency.3:25 build/C/man3/pthread_setname_np.3:26 build/C/man3/pthread_setschedparam.3:26 build/C/man3/pthread_setschedprio.3:26 build/C/man3/pthread_sigmask.3:26 build/C/man3/pthread_sigqueue.3:25 build/C/man3/pthread_testcancel.3:26 build/C/man3/pthread_tryjoin_np.3:26 build/C/man3/pthread_yield.3:25 build/C/man7/pthreads.7:26
33 #, no-wrap
34 msgid "Linux"
35 msgstr ""
36
37 #. type: TH
38 #: build/C/man3/getcontext.3:25 build/C/man3/makecontext.3:28 build/C/man3/pthread_attr_init.3:26 build/C/man3/pthread_attr_setaffinity_np.3:26 build/C/man3/pthread_attr_setdetachstate.3:26 build/C/man3/pthread_attr_setguardsize.3:26 build/C/man3/pthread_attr_setinheritsched.3:26 build/C/man3/pthread_attr_setschedparam.3:26 build/C/man3/pthread_attr_setschedpolicy.3:26 build/C/man3/pthread_attr_setscope.3:26 build/C/man3/pthread_attr_setstack.3:26 build/C/man3/pthread_attr_setstackaddr.3:26 build/C/man3/pthread_attr_setstacksize.3:26 build/C/man3/pthread_cancel.3:26 build/C/man3/pthread_cleanup_push.3:26 build/C/man3/pthread_cleanup_push_defer_np.3:26 build/C/man3/pthread_create.3:26 build/C/man3/pthread_detach.3:26 build/C/man3/pthread_equal.3:26 build/C/man3/pthread_exit.3:26 build/C/man3/pthread_getattr_np.3:26 build/C/man3/pthread_getcpuclockid.3:26 build/C/man3/pthread_join.3:26 build/C/man3/pthread_kill.3:26 build/C/man3/pthread_kill_other_threads_np.3:26 build/C/man3/pthread_rwlockattr_setkind_np.3:25 build/C/man3/pthread_self.3:26 build/C/man3/pthread_setaffinity_np.3:26 build/C/man3/pthread_setcancelstate.3:26 build/C/man3/pthread_setconcurrency.3:25 build/C/man3/pthread_setname_np.3:26 build/C/man3/pthread_setschedparam.3:26 build/C/man3/pthread_setschedprio.3:26 build/C/man3/pthread_sigmask.3:26 build/C/man3/pthread_sigqueue.3:25 build/C/man3/pthread_testcancel.3:26 build/C/man3/pthread_tryjoin_np.3:26 build/C/man3/pthread_yield.3:25 build/C/man7/pthreads.7:26
39 #, no-wrap
40 msgid "Linux Programmer's Manual"
41 msgstr ""
42
43 #. type: SH
44 #: build/C/man3/getcontext.3:26 build/C/man3/makecontext.3:29 build/C/man3/pthread_attr_init.3:27 build/C/man3/pthread_attr_setaffinity_np.3:27 build/C/man3/pthread_attr_setdetachstate.3:27 build/C/man3/pthread_attr_setguardsize.3:27 build/C/man3/pthread_attr_setinheritsched.3:27 build/C/man3/pthread_attr_setschedparam.3:27 build/C/man3/pthread_attr_setschedpolicy.3:27 build/C/man3/pthread_attr_setscope.3:27 build/C/man3/pthread_attr_setstack.3:27 build/C/man3/pthread_attr_setstackaddr.3:27 build/C/man3/pthread_attr_setstacksize.3:27 build/C/man3/pthread_cancel.3:27 build/C/man3/pthread_cleanup_push.3:27 build/C/man3/pthread_cleanup_push_defer_np.3:27 build/C/man3/pthread_create.3:27 build/C/man3/pthread_detach.3:27 build/C/man3/pthread_equal.3:27 build/C/man3/pthread_exit.3:27 build/C/man3/pthread_getattr_np.3:27 build/C/man3/pthread_getcpuclockid.3:27 build/C/man3/pthread_join.3:27 build/C/man3/pthread_kill.3:27 build/C/man3/pthread_kill_other_threads_np.3:27 build/C/man3/pthread_rwlockattr_setkind_np.3:26 build/C/man3/pthread_self.3:27 build/C/man3/pthread_setaffinity_np.3:27 build/C/man3/pthread_setcancelstate.3:27 build/C/man3/pthread_setconcurrency.3:26 build/C/man3/pthread_setname_np.3:27 build/C/man3/pthread_setschedparam.3:27 build/C/man3/pthread_setschedprio.3:27 build/C/man3/pthread_sigmask.3:27 build/C/man3/pthread_sigqueue.3:26 build/C/man3/pthread_testcancel.3:27 build/C/man3/pthread_tryjoin_np.3:27 build/C/man3/pthread_yield.3:26 build/C/man7/pthreads.7:27
45 #, no-wrap
46 msgid "NAME"
47 msgstr ""
48
49 #. type: Plain text
50 #: build/C/man3/getcontext.3:28
51 msgid "getcontext, setcontext - get or set the user context"
52 msgstr ""
53
54 #. type: SH
55 #: build/C/man3/getcontext.3:28 build/C/man3/makecontext.3:31 build/C/man3/pthread_attr_init.3:30 build/C/man3/pthread_attr_setaffinity_np.3:30 build/C/man3/pthread_attr_setdetachstate.3:30 build/C/man3/pthread_attr_setguardsize.3:30 build/C/man3/pthread_attr_setinheritsched.3:30 build/C/man3/pthread_attr_setschedparam.3:30 build/C/man3/pthread_attr_setschedpolicy.3:30 build/C/man3/pthread_attr_setscope.3:30 build/C/man3/pthread_attr_setstack.3:30 build/C/man3/pthread_attr_setstackaddr.3:30 build/C/man3/pthread_attr_setstacksize.3:30 build/C/man3/pthread_cancel.3:29 build/C/man3/pthread_cleanup_push.3:30 build/C/man3/pthread_cleanup_push_defer_np.3:30 build/C/man3/pthread_create.3:29 build/C/man3/pthread_detach.3:29 build/C/man3/pthread_equal.3:29 build/C/man3/pthread_exit.3:29 build/C/man3/pthread_getattr_np.3:29 build/C/man3/pthread_getcpuclockid.3:29 build/C/man3/pthread_join.3:29 build/C/man3/pthread_kill.3:29 build/C/man3/pthread_kill_other_threads_np.3:29 build/C/man3/pthread_rwlockattr_setkind_np.3:29 build/C/man3/pthread_self.3:29 build/C/man3/pthread_setaffinity_np.3:30 build/C/man3/pthread_setcancelstate.3:30 build/C/man3/pthread_setconcurrency.3:29 build/C/man3/pthread_setname_np.3:29 build/C/man3/pthread_setschedparam.3:30 build/C/man3/pthread_setschedprio.3:29 build/C/man3/pthread_sigmask.3:29 build/C/man3/pthread_sigqueue.3:28 build/C/man3/pthread_testcancel.3:29 build/C/man3/pthread_tryjoin_np.3:30 build/C/man3/pthread_yield.3:28
56 #, no-wrap
57 msgid "SYNOPSIS"
58 msgstr ""
59
60 #. type: Plain text
61 #: build/C/man3/getcontext.3:30 build/C/man3/makecontext.3:33
62 msgid "B<#include E<lt>ucontext.hE<gt>>"
63 msgstr ""
64
65 #. type: Plain text
66 #: build/C/man3/getcontext.3:32
67 msgid "B<int getcontext(ucontext_t *>I<ucp>B<);>"
68 msgstr ""
69
70 #. type: Plain text
71 #: build/C/man3/getcontext.3:34
72 msgid "B<int setcontext(const ucontext_t *>I<ucp>B<);>"
73 msgstr ""
74
75 #. type: SH
76 #: build/C/man3/getcontext.3:34 build/C/man3/makecontext.3:38 build/C/man3/pthread_attr_init.3:39 build/C/man3/pthread_attr_setaffinity_np.3:42 build/C/man3/pthread_attr_setdetachstate.3:41 build/C/man3/pthread_attr_setguardsize.3:41 build/C/man3/pthread_attr_setinheritsched.3:41 build/C/man3/pthread_attr_setschedparam.3:41 build/C/man3/pthread_attr_setschedpolicy.3:41 build/C/man3/pthread_attr_setscope.3:41 build/C/man3/pthread_attr_setstack.3:54 build/C/man3/pthread_attr_setstackaddr.3:41 build/C/man3/pthread_attr_setstacksize.3:41 build/C/man3/pthread_cancel.3:37 build/C/man3/pthread_cleanup_push.3:40 build/C/man3/pthread_cleanup_push_defer_np.3:53 build/C/man3/pthread_create.3:38 build/C/man3/pthread_detach.3:37 build/C/man3/pthread_equal.3:37 build/C/man3/pthread_exit.3:37 build/C/man3/pthread_getattr_np.3:38 build/C/man3/pthread_getcpuclockid.3:38 build/C/man3/pthread_join.3:37 build/C/man3/pthread_kill.3:49 build/C/man3/pthread_kill_other_threads_np.3:35 build/C/man3/pthread_rwlockattr_setkind_np.3:54 build/C/man3/pthread_self.3:37 build/C/man3/pthread_setaffinity_np.3:42 build/C/man3/pthread_setcancelstate.3:39 build/C/man3/pthread_setconcurrency.3:38 build/C/man3/pthread_setname_np.3:39 build/C/man3/pthread_setschedparam.3:41 build/C/man3/pthread_setschedprio.3:37 build/C/man3/pthread_sigmask.3:50 build/C/man3/pthread_sigqueue.3:46 build/C/man3/pthread_testcancel.3:37 build/C/man3/pthread_tryjoin_np.3:42 build/C/man3/pthread_yield.3:37 build/C/man7/pthreads.7:29
77 #, no-wrap
78 msgid "DESCRIPTION"
79 msgstr ""
80
81 #. type: Plain text
82 #: build/C/man3/getcontext.3:49
83 msgid ""
84 "In a System V-like environment, one has the two types I<mcontext_t> and "
85 "I<ucontext_t> defined in I<E<lt>ucontext.hE<gt>> and the four functions "
86 "B<getcontext>(), B<setcontext>(), B<makecontext>(3), and B<swapcontext>(3)  "
87 "that allow user-level context switching between multiple threads of control "
88 "within a process."
89 msgstr ""
90
91 #. type: Plain text
92 #: build/C/man3/getcontext.3:57
93 msgid ""
94 "The I<mcontext_t> type is machine-dependent and opaque.  The I<ucontext_t> "
95 "type is a structure that has at least the following fields:"
96 msgstr ""
97
98 #. type: Plain text
99 #: build/C/man3/getcontext.3:67
100 #, no-wrap
101 msgid ""
102 "typedef struct ucontext {\n"
103 "    struct ucontext *uc_link;\n"
104 "    sigset_t         uc_sigmask;\n"
105 "    stack_t          uc_stack;\n"
106 "    mcontext_t       uc_mcontext;\n"
107 "    ...\n"
108 "} ucontext_t;\n"
109 msgstr ""
110
111 #. type: Plain text
112 #: build/C/man3/getcontext.3:94
113 msgid ""
114 "with I<sigset_t> and I<stack_t> defined in I<E<lt>signal.hE<gt>>.  Here "
115 "I<uc_link> points to the context that will be resumed when the current "
116 "context terminates (in case the current context was created using "
117 "B<makecontext>(3)), I<uc_sigmask> is the set of signals blocked in this "
118 "context (see B<sigprocmask>(2)), I<uc_stack> is the stack used by this "
119 "context (see B<sigaltstack>(2)), and I<uc_mcontext> is the machine-specific "
120 "representation of the saved context, that includes the calling thread's "
121 "machine registers."
122 msgstr ""
123
124 #. type: Plain text
125 #: build/C/man3/getcontext.3:101
126 msgid ""
127 "The function B<getcontext>()  initializes the structure pointed at by I<ucp> "
128 "to the currently active context."
129 msgstr ""
130
131 #. type: Plain text
132 #: build/C/man3/getcontext.3:114
133 msgid ""
134 "The function B<setcontext>()  restores the user context pointed at by "
135 "I<ucp>.  A successful call does not return.  The context should have been "
136 "obtained by a call of B<getcontext>(), or B<makecontext>(3), or passed as "
137 "third argument to a signal handler."
138 msgstr ""
139
140 #. type: Plain text
141 #: build/C/man3/getcontext.3:118
142 msgid ""
143 "If the context was obtained by a call of B<getcontext>(), program execution "
144 "continues as if this call just returned."
145 msgstr ""
146
147 #. type: Plain text
148 #: build/C/man3/getcontext.3:135
149 msgid ""
150 "If the context was obtained by a call of B<makecontext>(3), program "
151 "execution continues by a call to the function I<func> specified as the "
152 "second argument of that call to B<makecontext>(3).  When the function "
153 "I<func> returns, we continue with the I<uc_link> member of the structure "
154 "I<ucp> specified as the first argument of that call to B<makecontext>(3).  "
155 "When this member is NULL, the thread exits."
156 msgstr ""
157
158 #. type: Plain text
159 #: build/C/man3/getcontext.3:142
160 msgid ""
161 "If the context was obtained by a call to a signal handler, then old standard "
162 "text says that \"program execution continues with the program instruction "
163 "following the instruction interrupted by the signal\".  However, this "
164 "sentence was removed in SUSv2, and the present verdict is \"the result is "
165 "unspecified\"."
166 msgstr ""
167
168 #. type: SH
169 #: build/C/man3/getcontext.3:142 build/C/man3/makecontext.3:84 build/C/man3/pthread_attr_init.3:68 build/C/man3/pthread_attr_setaffinity_np.3:76 build/C/man3/pthread_attr_setdetachstate.3:77 build/C/man3/pthread_attr_setguardsize.3:90 build/C/man3/pthread_attr_setinheritsched.3:93 build/C/man3/pthread_attr_setschedparam.3:85 build/C/man3/pthread_attr_setschedpolicy.3:83 build/C/man3/pthread_attr_setscope.3:103 build/C/man3/pthread_attr_setstack.3:85 build/C/man3/pthread_attr_setstackaddr.3:74 build/C/man3/pthread_attr_setstacksize.3:61 build/C/man3/pthread_cancel.3:112 build/C/man3/pthread_cleanup_push.3:121 build/C/man3/pthread_create.3:115 build/C/man3/pthread_detach.3:49 build/C/man3/pthread_equal.3:41 build/C/man3/pthread_exit.3:71 build/C/man3/pthread_getattr_np.3:73 build/C/man3/pthread_getcpuclockid.3:46 build/C/man3/pthread_join.3:70 build/C/man3/pthread_kill.3:63 build/C/man3/pthread_rwlockattr_setkind_np.3:96 build/C/man3/pthread_self.3:46 build/C/man3/pthread_setaffinity_np.3:77 build/C/man3/pthread_setcancelstate.3:92 build/C/man3/pthread_setconcurrency.3:56 build/C/man3/pthread_setname_np.3:72 build/C/man3/pthread_setschedparam.3:104 build/C/man3/pthread_setschedprio.3:53 build/C/man3/pthread_sigmask.3:61 build/C/man3/pthread_sigqueue.3:66 build/C/man3/pthread_testcancel.3:50 build/C/man3/pthread_tryjoin_np.3:85 build/C/man3/pthread_yield.3:44
170 #, no-wrap
171 msgid "RETURN VALUE"
172 msgstr ""
173
174 #. type: Plain text
175 #: build/C/man3/getcontext.3:151
176 msgid ""
177 "When successful, B<getcontext>()  returns 0 and B<setcontext>()  does not "
178 "return.  On error, both return -1 and set I<errno> appropriately."
179 msgstr ""
180
181 #. type: SH
182 #: build/C/man3/getcontext.3:151 build/C/man3/makecontext.3:96 build/C/man3/pthread_attr_init.3:71 build/C/man3/pthread_attr_setaffinity_np.3:79 build/C/man3/pthread_attr_setdetachstate.3:80 build/C/man3/pthread_attr_setguardsize.3:93 build/C/man3/pthread_attr_setinheritsched.3:96 build/C/man3/pthread_attr_setschedparam.3:88 build/C/man3/pthread_attr_setschedpolicy.3:86 build/C/man3/pthread_attr_setscope.3:106 build/C/man3/pthread_attr_setstack.3:88 build/C/man3/pthread_attr_setstackaddr.3:77 build/C/man3/pthread_attr_setstacksize.3:64 build/C/man3/pthread_cancel.3:117 build/C/man3/pthread_cleanup_push.3:123 build/C/man3/pthread_create.3:122 build/C/man3/pthread_detach.3:54 build/C/man3/pthread_equal.3:45 build/C/man3/pthread_exit.3:73 build/C/man3/pthread_getattr_np.3:76 build/C/man3/pthread_getcpuclockid.3:49 build/C/man3/pthread_join.3:75 build/C/man3/pthread_kill.3:68 build/C/man3/pthread_rwlockattr_setkind_np.3:104 build/C/man3/pthread_self.3:48 build/C/man3/pthread_setaffinity_np.3:80 build/C/man3/pthread_setcancelstate.3:95 build/C/man3/pthread_setconcurrency.3:68 build/C/man3/pthread_setname_np.3:75 build/C/man3/pthread_setschedparam.3:112 build/C/man3/pthread_setschedprio.3:61 build/C/man3/pthread_sigmask.3:66 build/C/man3/pthread_sigqueue.3:71 build/C/man3/pthread_testcancel.3:54 build/C/man3/pthread_tryjoin_np.3:89 build/C/man3/pthread_yield.3:49
183 #, no-wrap
184 msgid "ERRORS"
185 msgstr ""
186
187 #. type: Plain text
188 #: build/C/man3/getcontext.3:153
189 msgid "None defined."
190 msgstr ""
191
192 #. type: SH
193 #: build/C/man3/getcontext.3:153 build/C/man3/makecontext.3:105 build/C/man3/pthread_attr_setdetachstate.3:87 build/C/man3/pthread_attr_setguardsize.3:106 build/C/man3/pthread_attr_setinheritsched.3:110 build/C/man3/pthread_attr_setschedparam.3:100 build/C/man3/pthread_attr_setschedpolicy.3:100 build/C/man3/pthread_attr_setscope.3:119 build/C/man3/pthread_attr_setstack.3:112 build/C/man3/pthread_attr_setstackaddr.3:83 build/C/man3/pthread_attr_setstacksize.3:83 build/C/man3/pthread_equal.3:47 build/C/man3/pthread_exit.3:75 build/C/man3/pthread_getcpuclockid.3:65 build/C/man3/pthread_kill.3:72 build/C/man3/pthread_kill_other_threads_np.3:47 build/C/man3/pthread_self.3:50 build/C/man3/pthread_setaffinity_np.3:121 build/C/man3/pthread_setcancelstate.3:113 build/C/man3/pthread_setconcurrency.3:83 build/C/man3/pthread_setschedparam.3:141 build/C/man3/pthread_setschedprio.3:83 build/C/man3/pthread_sigmask.3:69 build/C/man3/pthread_sigqueue.3:94 build/C/man3/pthread_testcancel.3:58 build/C/man3/pthread_yield.3:53
194 #, no-wrap
195 msgid "ATTRIBUTES"
196 msgstr ""
197
198 #. type: SS
199 #: build/C/man3/getcontext.3:154 build/C/man3/makecontext.3:106 build/C/man3/pthread_attr_setdetachstate.3:88 build/C/man3/pthread_attr_setguardsize.3:107 build/C/man3/pthread_attr_setinheritsched.3:111 build/C/man3/pthread_attr_setschedparam.3:101 build/C/man3/pthread_attr_setschedpolicy.3:101 build/C/man3/pthread_attr_setscope.3:120 build/C/man3/pthread_attr_setstack.3:113 build/C/man3/pthread_attr_setstackaddr.3:84 build/C/man3/pthread_attr_setstacksize.3:84 build/C/man3/pthread_equal.3:48 build/C/man3/pthread_exit.3:76 build/C/man3/pthread_getcpuclockid.3:66 build/C/man3/pthread_kill.3:73 build/C/man3/pthread_kill_other_threads_np.3:48 build/C/man3/pthread_self.3:51 build/C/man3/pthread_setaffinity_np.3:122 build/C/man3/pthread_setcancelstate.3:114 build/C/man3/pthread_setconcurrency.3:84 build/C/man3/pthread_setschedparam.3:142 build/C/man3/pthread_setschedprio.3:84 build/C/man3/pthread_sigmask.3:70 build/C/man3/pthread_sigqueue.3:95 build/C/man3/pthread_testcancel.3:59 build/C/man3/pthread_yield.3:54
200 #, no-wrap
201 msgid "Multithreading (see pthreads(7))"
202 msgstr ""
203
204 #. type: Plain text
205 #: build/C/man3/getcontext.3:160
206 msgid "The B<getcontext>()  and B<setcontext>()  functions are thread-safe."
207 msgstr ""
208
209 #. type: SH
210 #: build/C/man3/getcontext.3:160 build/C/man3/makecontext.3:112 build/C/man3/pthread_attr_init.3:79 build/C/man3/pthread_attr_setaffinity_np.3:108 build/C/man3/pthread_attr_setdetachstate.3:94 build/C/man3/pthread_attr_setguardsize.3:113 build/C/man3/pthread_attr_setinheritsched.3:117 build/C/man3/pthread_attr_setschedparam.3:107 build/C/man3/pthread_attr_setschedpolicy.3:107 build/C/man3/pthread_attr_setscope.3:126 build/C/man3/pthread_attr_setstack.3:119 build/C/man3/pthread_attr_setstackaddr.3:90 build/C/man3/pthread_attr_setstacksize.3:90 build/C/man3/pthread_cancel.3:125 build/C/man3/pthread_cleanup_push.3:127 build/C/man3/pthread_cleanup_push_defer_np.3:114 build/C/man3/pthread_create.3:153 build/C/man3/pthread_detach.3:64 build/C/man3/pthread_equal.3:52 build/C/man3/pthread_exit.3:80 build/C/man3/pthread_getattr_np.3:98 build/C/man3/pthread_getcpuclockid.3:70 build/C/man3/pthread_join.3:98 build/C/man3/pthread_kill.3:77 build/C/man3/pthread_kill_other_threads_np.3:52 build/C/man3/pthread_rwlockattr_setkind_np.3:127 build/C/man3/pthread_self.3:55 build/C/man3/pthread_setaffinity_np.3:128 build/C/man3/pthread_setcancelstate.3:120 build/C/man3/pthread_setconcurrency.3:90 build/C/man3/pthread_setname_np.3:102 build/C/man3/pthread_setschedparam.3:148 build/C/man3/pthread_setschedprio.3:88 build/C/man3/pthread_sigmask.3:74 build/C/man3/pthread_sigqueue.3:99 build/C/man3/pthread_testcancel.3:63 build/C/man3/pthread_tryjoin_np.3:120 build/C/man3/pthread_yield.3:58
211 #, no-wrap
212 msgid "CONFORMING TO"
213 msgstr ""
214
215 #. type: Plain text
216 #: build/C/man3/getcontext.3:166
217 msgid ""
218 "SUSv2, POSIX.1-2001.  POSIX.1-2008 removes the specification of "
219 "B<getcontext>(), citing portability issues, and recommending that "
220 "applications be rewritten to use POSIX threads instead."
221 msgstr ""
222
223 #. type: SH
224 #: build/C/man3/getcontext.3:166 build/C/man3/makecontext.3:120 build/C/man3/pthread_attr_init.3:81 build/C/man3/pthread_attr_setaffinity_np.3:111 build/C/man3/pthread_attr_setdetachstate.3:96 build/C/man3/pthread_attr_setguardsize.3:115 build/C/man3/pthread_attr_setschedparam.3:109 build/C/man3/pthread_attr_setscope.3:128 build/C/man3/pthread_attr_setstack.3:121 build/C/man3/pthread_attr_setstackaddr.3:93 build/C/man3/pthread_attr_setstacksize.3:92 build/C/man3/pthread_cancel.3:127 build/C/man3/pthread_cleanup_push.3:129 build/C/man3/pthread_create.3:155 build/C/man3/pthread_detach.3:66 build/C/man3/pthread_equal.3:54 build/C/man3/pthread_exit.3:82 build/C/man3/pthread_getcpuclockid.3:72 build/C/man3/pthread_join.3:100 build/C/man3/pthread_kill.3:79 build/C/man3/pthread_kill_other_threads_np.3:55 build/C/man3/pthread_self.3:57 build/C/man3/pthread_setaffinity_np.3:131 build/C/man3/pthread_setcancelstate.3:122 build/C/man3/pthread_setconcurrency.3:92 build/C/man3/pthread_setname_np.3:104 build/C/man3/pthread_setschedparam.3:150 build/C/man3/pthread_setschedprio.3:90 build/C/man3/pthread_sigmask.3:76 build/C/man3/pthread_yield.3:64
225 #, no-wrap
226 msgid "NOTES"
227 msgstr ""
228
229 #. type: Plain text
230 #: build/C/man3/getcontext.3:183
231 msgid ""
232 "The earliest incarnation of this mechanism was the "
233 "B<setjmp>(3)/B<longjmp>(3)  mechanism.  Since that does not define the "
234 "handling of the signal context, the next stage was the "
235 "B<sigsetjmp>(3)/B<siglongjmp>(3)  pair.  The present mechanism gives much "
236 "more control.  On the other hand, there is no easy way to detect whether a "
237 "return from B<getcontext>()  is from the first call, or via a "
238 "B<setcontext>()  call.  The user has to invent her own bookkeeping device, "
239 "and a register variable won't do since registers are restored."
240 msgstr ""
241
242 #. type: Plain text
243 #: build/C/man3/getcontext.3:194
244 msgid ""
245 "When a signal occurs, the current user context is saved and a new context is "
246 "created by the kernel for the signal handler.  Do not leave the handler "
247 "using B<longjmp>(3): it is undefined what would happen with contexts.  Use "
248 "B<siglongjmp>(3)  or B<setcontext>()  instead."
249 msgstr ""
250
251 #. type: SH
252 #: build/C/man3/getcontext.3:194 build/C/man3/makecontext.3:227 build/C/man3/pthread_attr_init.3:297 build/C/man3/pthread_attr_setaffinity_np.3:118 build/C/man3/pthread_attr_setdetachstate.3:118 build/C/man3/pthread_attr_setguardsize.3:165 build/C/man3/pthread_attr_setinheritsched.3:138 build/C/man3/pthread_attr_setschedparam.3:116 build/C/man3/pthread_attr_setschedpolicy.3:112 build/C/man3/pthread_attr_setscope.3:139 build/C/man3/pthread_attr_setstack.3:162 build/C/man3/pthread_attr_setstackaddr.3:117 build/C/man3/pthread_attr_setstacksize.3:118 build/C/man3/pthread_cancel.3:226 build/C/man3/pthread_cleanup_push.3:315 build/C/man3/pthread_cleanup_push_defer_np.3:117 build/C/man3/pthread_create.3:376 build/C/man3/pthread_detach.3:97 build/C/man3/pthread_equal.3:61 build/C/man3/pthread_exit.3:110 build/C/man3/pthread_getattr_np.3:345 build/C/man3/pthread_getcpuclockid.3:175 build/C/man3/pthread_join.3:127 build/C/man3/pthread_kill.3:99 build/C/man3/pthread_kill_other_threads_np.3:71 build/C/man3/pthread_rwlockattr_setkind_np.3:130 build/C/man3/pthread_self.3:81 build/C/man3/pthread_setaffinity_np.3:213 build/C/man3/pthread_setcancelstate.3:186 build/C/man3/pthread_setconcurrency.3:107 build/C/man3/pthread_setname_np.3:200 build/C/man3/pthread_setschedparam.3:440 build/C/man3/pthread_setschedprio.3:96 build/C/man3/pthread_sigmask.3:152 build/C/man3/pthread_sigqueue.3:101 build/C/man3/pthread_testcancel.3:68 build/C/man3/pthread_tryjoin_np.3:143 build/C/man3/pthread_yield.3:67 build/C/man7/pthreads.7:893
253 #, no-wrap
254 msgid "SEE ALSO"
255 msgstr ""
256
257 #. type: Plain text
258 #: build/C/man3/getcontext.3:200
259 msgid ""
260 "B<sigaction>(2), B<sigaltstack>(2), B<sigprocmask>(2), B<longjmp>(3), "
261 "B<makecontext>(3), B<sigsetjmp>(3)"
262 msgstr ""
263
264 #. type: TH
265 #: build/C/man3/makecontext.3:28
266 #, no-wrap
267 msgid "MAKECONTEXT"
268 msgstr ""
269
270 #. type: TH
271 #: build/C/man3/makecontext.3:28 build/C/man3/pthread_attr_setaffinity_np.3:26 build/C/man3/pthread_attr_setdetachstate.3:26 build/C/man3/pthread_attr_setguardsize.3:26 build/C/man3/pthread_attr_setscope.3:26 build/C/man3/pthread_attr_setstack.3:26 build/C/man3/pthread_attr_setstackaddr.3:26 build/C/man3/pthread_attr_setstacksize.3:26 build/C/man3/pthread_cleanup_push_defer_np.3:26 build/C/man3/pthread_create.3:26 build/C/man3/pthread_setname_np.3:26 build/C/man3/pthread_setschedprio.3:26 build/C/man3/pthread_sigqueue.3:25
272 #, no-wrap
273 msgid "2014-05-28"
274 msgstr ""
275
276 #. type: TH
277 #: build/C/man3/makecontext.3:28
278 #, no-wrap
279 msgid "GNU"
280 msgstr ""
281
282 #. type: Plain text
283 #: build/C/man3/makecontext.3:31
284 msgid "makecontext, swapcontext - manipulate user context"
285 msgstr ""
286
287 #. type: Plain text
288 #: build/C/man3/makecontext.3:36
289 msgid ""
290 "B<void makecontext(ucontext_t *>I<ucp>B<, void (*>I<func>B<)(),> B<int "
291 ">I<argc>B<, ...);>"
292 msgstr ""
293
294 #. type: Plain text
295 #: build/C/man3/makecontext.3:38
296 msgid "B<int swapcontext(ucontext_t *>I<oucp>B<, const ucontext_t *>I<ucp>B<);>"
297 msgstr ""
298
299 #. type: Plain text
300 #: build/C/man3/makecontext.3:49
301 msgid ""
302 "In a System V-like environment, one has the type I<ucontext_t> defined in "
303 "I<E<lt>ucontext.hE<gt>> and the four functions B<getcontext>(3), "
304 "B<setcontext>(3), B<makecontext>()  and B<swapcontext>()  that allow "
305 "user-level context switching between multiple threads of control within a "
306 "process."
307 msgstr ""
308
309 #. type: Plain text
310 #: build/C/man3/makecontext.3:52
311 msgid "For the type and the first two functions, see B<getcontext>(3)."
312 msgstr ""
313
314 #. type: Plain text
315 #: build/C/man3/makecontext.3:64
316 msgid ""
317 "The B<makecontext>()  function modifies the context pointed to by I<ucp> "
318 "(which was obtained from a call to B<getcontext>(3)).  Before invoking "
319 "B<makecontext>(), the caller must allocate a new stack for this context and "
320 "assign its address to I<ucp-E<gt>uc_stack>, and define a successor context "
321 "and assign its address to I<ucp-E<gt>uc_link>."
322 msgstr ""
323
324 #. type: Plain text
325 #: build/C/man3/makecontext.3:78
326 msgid ""
327 "When this context is later activated (using B<setcontext>(3)  or "
328 "B<swapcontext>())  the function I<func> is called, and passed the series of "
329 "integer (I<int>)  arguments that follow I<argc>; the caller must specify the "
330 "number of these arguments in I<argc>.  When this function returns, the "
331 "successor context is activated.  If the successor context pointer is NULL, "
332 "the thread exits."
333 msgstr ""
334
335 #. type: Plain text
336 #: build/C/man3/makecontext.3:84
337 msgid ""
338 "The B<swapcontext>()  function saves the current context in the structure "
339 "pointed to by I<oucp>, and then activates the context pointed to by I<ucp>."
340 msgstr ""
341
342 #. type: Plain text
343 #: build/C/man3/makecontext.3:96
344 msgid ""
345 "When successful, B<swapcontext>()  does not return.  (But we may return "
346 "later, in case I<oucp> is activated, in which case it looks like "
347 "B<swapcontext>()  returns 0.)  On error, B<swapcontext>()  returns -1 and "
348 "sets I<errno> appropriately."
349 msgstr ""
350
351 #. type: TP
352 #: build/C/man3/makecontext.3:97 build/C/man3/pthread_attr_setaffinity_np.3:102 build/C/man3/pthread_getattr_np.3:77
353 #, no-wrap
354 msgid "B<ENOMEM>"
355 msgstr ""
356
357 #. type: Plain text
358 #: build/C/man3/makecontext.3:100
359 msgid "Insufficient stack space left."
360 msgstr ""
361
362 #. type: SH
363 #: build/C/man3/makecontext.3:100 build/C/man3/pthread_attr_setaffinity_np.3:106 build/C/man3/pthread_attr_setguardsize.3:104 build/C/man3/pthread_attr_setstack.3:110 build/C/man3/pthread_attr_setstackaddr.3:81 build/C/man3/pthread_attr_setstacksize.3:81 build/C/man3/pthread_getattr_np.3:96 build/C/man3/pthread_getcpuclockid.3:63 build/C/man3/pthread_rwlockattr_setkind_np.3:121 build/C/man3/pthread_setaffinity_np.3:119 build/C/man3/pthread_setconcurrency.3:81 build/C/man3/pthread_setname_np.3:100 build/C/man3/pthread_setschedprio.3:81 build/C/man3/pthread_sigqueue.3:90 build/C/man3/pthread_tryjoin_np.3:118
364 #, no-wrap
365 msgid "VERSIONS"
366 msgstr ""
367
368 #. type: Plain text
369 #: build/C/man3/makecontext.3:105
370 msgid ""
371 "B<makecontext>()  and B<swapcontext>()  are provided in glibc since version "
372 "2.1."
373 msgstr ""
374
375 #. type: Plain text
376 #: build/C/man3/makecontext.3:112
377 msgid "The B<makecontext>()  and B<swapcontext>()  functions are thread-safe."
378 msgstr ""
379
380 #. type: Plain text
381 #: build/C/man3/makecontext.3:120
382 msgid ""
383 "SUSv2, POSIX.1-2001.  POSIX.1-2008 removes the specifications of "
384 "B<makecontext>()  and B<swapcontext>(), citing portability issues, and "
385 "recommending that applications be rewritten to use POSIX threads instead."
386 msgstr ""
387
388 #. type: Plain text
389 #: build/C/man3/makecontext.3:128
390 msgid ""
391 "The interpretation of I<ucp-E<gt>uc_stack> is just as in B<sigaltstack>(2), "
392 "namely, this struct contains the start and length of a memory area to be "
393 "used as the stack, regardless of the direction of growth of the stack.  "
394 "Thus, it is not necessary for the user program to worry about this "
395 "direction."
396 msgstr ""
397
398 #. type: Plain text
399 #: build/C/man3/makecontext.3:144
400 msgid ""
401 "On architectures where I<int> and pointer types are the same size (e.g., "
402 "x86-32, where both types are 32 bits), you may be able to get away with "
403 "passing pointers as arguments to B<makecontext>()  following I<argc>.  "
404 "However, doing this is not guaranteed to be portable, is undefined according "
405 "to the standards, and won't work on architectures where pointers are larger "
406 "than I<int>s.  Nevertheless, starting with version 2.8, glibc makes some "
407 "changes to B<makecontext>(), to permit this on some 64-bit architectures "
408 "(e.g., x86-64)."
409 msgstr ""
410
411 #. type: SH
412 #: build/C/man3/makecontext.3:144 build/C/man3/pthread_attr_init.3:87 build/C/man3/pthread_attr_setdetachstate.3:115 build/C/man3/pthread_attr_setguardsize.3:162 build/C/man3/pthread_attr_setinheritsched.3:135 build/C/man3/pthread_attr_setschedparam.3:113 build/C/man3/pthread_attr_setschedpolicy.3:109 build/C/man3/pthread_attr_setstack.3:159 build/C/man3/pthread_attr_setstacksize.3:115 build/C/man3/pthread_cancel.3:135 build/C/man3/pthread_cleanup_push.3:155 build/C/man3/pthread_create.3:209 build/C/man3/pthread_detach.3:93 build/C/man3/pthread_getattr_np.3:101 build/C/man3/pthread_getcpuclockid.3:83 build/C/man3/pthread_join.3:124 build/C/man3/pthread_setaffinity_np.3:161 build/C/man3/pthread_setcancelstate.3:183 build/C/man3/pthread_setname_np.3:114 build/C/man3/pthread_setschedparam.3:156 build/C/man3/pthread_sigmask.3:78 build/C/man3/pthread_testcancel.3:65 build/C/man3/pthread_tryjoin_np.3:123
413 #, no-wrap
414 msgid "EXAMPLE"
415 msgstr ""
416
417 #. type: Plain text
418 #: build/C/man3/makecontext.3:152
419 msgid ""
420 "The example program below demonstrates the use of B<getcontext>(3), "
421 "B<makecontext>(), and B<swapcontext>().  Running the program produces the "
422 "following output:"
423 msgstr ""
424
425 #. type: Plain text
426 #: build/C/man3/makecontext.3:164
427 #, no-wrap
428 msgid ""
429 "$B< ./a.out>\n"
430 "main: swapcontext(&uctx_main, &uctx_func2)\n"
431 "func2: started\n"
432 "func2: swapcontext(&uctx_func2, &uctx_func1)\n"
433 "func1: started\n"
434 "func1: swapcontext(&uctx_func1, &uctx_func2)\n"
435 "func2: returning\n"
436 "func1: returning\n"
437 "main: exiting\n"
438 msgstr ""
439
440 #. type: SS
441 #: build/C/man3/makecontext.3:166 build/C/man3/pthread_attr_init.3:148 build/C/man3/pthread_cancel.3:151 build/C/man3/pthread_cleanup_push.3:231 build/C/man3/pthread_create.3:248 build/C/man3/pthread_getattr_np.3:179 build/C/man3/pthread_getcpuclockid.3:101 build/C/man3/pthread_setname_np.3:140 build/C/man3/pthread_setschedparam.3:231 build/C/man3/pthread_sigmask.3:96
442 #, no-wrap
443 msgid "Program source"
444 msgstr ""
445
446 #. type: Plain text
447 #: build/C/man3/makecontext.3:172
448 #, no-wrap
449 msgid ""
450 "#include E<lt>ucontext.hE<gt>\n"
451 "#include E<lt>stdio.hE<gt>\n"
452 "#include E<lt>stdlib.hE<gt>\n"
453 msgstr ""
454
455 #. type: Plain text
456 #: build/C/man3/makecontext.3:174
457 #, no-wrap
458 msgid "static ucontext_t uctx_main, uctx_func1, uctx_func2;\n"
459 msgstr ""
460
461 #. type: Plain text
462 #: build/C/man3/makecontext.3:177
463 #, no-wrap
464 msgid ""
465 "#define handle_error(msg) \\e\n"
466 "    do { perror(msg); exit(EXIT_FAILURE); } while (0)\n"
467 msgstr ""
468
469 #. type: Plain text
470 #: build/C/man3/makecontext.3:187
471 #, no-wrap
472 msgid ""
473 "static void\n"
474 "func1(void)\n"
475 "{\n"
476 "    printf(\"func1: started\\en\");\n"
477 "    printf(\"func1: swapcontext(&uctx_func1, &uctx_func2)\\en\");\n"
478 "    if (swapcontext(&uctx_func1, &uctx_func2) == -1)\n"
479 "        handle_error(\"swapcontext\");\n"
480 "    printf(\"func1: returning\\en\");\n"
481 "}\n"
482 msgstr ""
483
484 #. type: Plain text
485 #: build/C/man3/makecontext.3:197
486 #, no-wrap
487 msgid ""
488 "static void\n"
489 "func2(void)\n"
490 "{\n"
491 "    printf(\"func2: started\\en\");\n"
492 "    printf(\"func2: swapcontext(&uctx_func2, &uctx_func1)\\en\");\n"
493 "    if (swapcontext(&uctx_func2, &uctx_func1) == -1)\n"
494 "        handle_error(\"swapcontext\");\n"
495 "    printf(\"func2: returning\\en\");\n"
496 "}\n"
497 msgstr ""
498
499 #. type: Plain text
500 #: build/C/man3/makecontext.3:203
501 #, no-wrap
502 msgid ""
503 "int\n"
504 "main(int argc, char *argv[])\n"
505 "{\n"
506 "    char func1_stack[16384];\n"
507 "    char func2_stack[16384];\n"
508 msgstr ""
509
510 #. type: Plain text
511 #: build/C/man3/makecontext.3:210
512 #, no-wrap
513 msgid ""
514 "    if (getcontext(&uctx_func1) == -1)\n"
515 "        handle_error(\"getcontext\");\n"
516 "    uctx_func1.uc_stack.ss_sp = func1_stack;\n"
517 "    uctx_func1.uc_stack.ss_size = sizeof(func1_stack);\n"
518 "    uctx_func1.uc_link = &uctx_main;\n"
519 "    makecontext(&uctx_func1, func1, 0);\n"
520 msgstr ""
521
522 #. type: Plain text
523 #: build/C/man3/makecontext.3:218
524 #, no-wrap
525 msgid ""
526 "    if (getcontext(&uctx_func2) == -1)\n"
527 "        handle_error(\"getcontext\");\n"
528 "    uctx_func2.uc_stack.ss_sp = func2_stack;\n"
529 "    uctx_func2.uc_stack.ss_size = sizeof(func2_stack);\n"
530 "    /* Successor context is f1(), unless argc E<gt> 1 */\n"
531 "    uctx_func2.uc_link = (argc E<gt> 1) ? NULL : &uctx_func1;\n"
532 "    makecontext(&uctx_func2, func2, 0);\n"
533 msgstr ""
534
535 #. type: Plain text
536 #: build/C/man3/makecontext.3:222
537 #, no-wrap
538 msgid ""
539 "    printf(\"main: swapcontext(&uctx_main, &uctx_func2)\\en\");\n"
540 "    if (swapcontext(&uctx_main, &uctx_func2) == -1)\n"
541 "        handle_error(\"swapcontext\");\n"
542 msgstr ""
543
544 #. type: Plain text
545 #: build/C/man3/makecontext.3:226
546 #, no-wrap
547 msgid ""
548 "    printf(\"main: exiting\\en\");\n"
549 "    exit(EXIT_SUCCESS);\n"
550 "}\n"
551 msgstr ""
552
553 #. type: Plain text
554 #: build/C/man3/makecontext.3:232
555 msgid ""
556 "B<sigaction>(2), B<sigaltstack>(2), B<sigprocmask>(2), B<getcontext>(3), "
557 "B<sigsetjmp>(3)"
558 msgstr ""
559
560 #. type: TH
561 #: build/C/man3/pthread_attr_init.3:26
562 #, no-wrap
563 msgid "PTHREAD_ATTR_INIT"
564 msgstr ""
565
566 #. type: TH
567 #: build/C/man3/pthread_attr_init.3:26
568 #, no-wrap
569 msgid "2008-11-11"
570 msgstr ""
571
572 #. type: Plain text
573 #: build/C/man3/pthread_attr_init.3:30
574 msgid ""
575 "pthread_attr_init, pthread_attr_destroy - initialize and destroy thread "
576 "attributes object"
577 msgstr ""
578
579 #. type: Plain text
580 #: build/C/man3/pthread_attr_init.3:33 build/C/man3/pthread_attr_setdetachstate.3:33 build/C/man3/pthread_attr_setguardsize.3:33 build/C/man3/pthread_attr_setinheritsched.3:33 build/C/man3/pthread_attr_setschedparam.3:33 build/C/man3/pthread_attr_setschedpolicy.3:33 build/C/man3/pthread_attr_setscope.3:33 build/C/man3/pthread_attr_setstack.3:33 build/C/man3/pthread_attr_setstackaddr.3:33 build/C/man3/pthread_attr_setstacksize.3:33 build/C/man3/pthread_cancel.3:32 build/C/man3/pthread_cleanup_push.3:33 build/C/man3/pthread_cleanup_push_defer_np.3:33 build/C/man3/pthread_create.3:32 build/C/man3/pthread_detach.3:32 build/C/man3/pthread_equal.3:32 build/C/man3/pthread_exit.3:32 build/C/man3/pthread_join.3:32 build/C/man3/pthread_kill_other_threads_np.3:32 build/C/man3/pthread_rwlockattr_setkind_np.3:32 build/C/man3/pthread_self.3:32 build/C/man3/pthread_setcancelstate.3:33 build/C/man3/pthread_setconcurrency.3:32 build/C/man3/pthread_setschedparam.3:33 build/C/man3/pthread_setschedprio.3:32 build/C/man3/pthread_testcancel.3:32
581 #, no-wrap
582 msgid "B<#include E<lt>pthread.hE<gt>>\n"
583 msgstr ""
584
585 #. type: Plain text
586 #: build/C/man3/pthread_attr_init.3:36
587 #, no-wrap
588 msgid ""
589 "B<int pthread_attr_init(pthread_attr_t *>I<attr>B<);>\n"
590 "B<int pthread_attr_destroy(pthread_attr_t *>I<attr>B<);>\n"
591 msgstr ""
592
593 #. type: Plain text
594 #: build/C/man3/pthread_attr_init.3:38 build/C/man3/pthread_attr_setaffinity_np.3:41 build/C/man3/pthread_attr_setdetachstate.3:40 build/C/man3/pthread_attr_setguardsize.3:40 build/C/man3/pthread_attr_setinheritsched.3:40 build/C/man3/pthread_attr_setschedparam.3:40 build/C/man3/pthread_attr_setschedpolicy.3:40 build/C/man3/pthread_attr_setscope.3:40 build/C/man3/pthread_attr_setstack.3:40 build/C/man3/pthread_attr_setstackaddr.3:40 build/C/man3/pthread_attr_setstacksize.3:40 build/C/man3/pthread_cancel.3:36 build/C/man3/pthread_cleanup_push.3:39 build/C/man3/pthread_equal.3:36 build/C/man3/pthread_exit.3:36 build/C/man3/pthread_getattr_np.3:37 build/C/man3/pthread_getcpuclockid.3:37 build/C/man3/pthread_rwlockattr_setkind_np.3:39 build/C/man3/pthread_self.3:36 build/C/man3/pthread_setaffinity_np.3:41 build/C/man3/pthread_setcancelstate.3:38 build/C/man3/pthread_setconcurrency.3:37 build/C/man3/pthread_setschedparam.3:40 build/C/man3/pthread_setschedprio.3:36 build/C/man3/pthread_testcancel.3:36
595 #, no-wrap
596 msgid "Compile and link with I<-pthread>.\n"
597 msgstr ""
598
599 #. type: Plain text
600 #: build/C/man3/pthread_attr_init.3:50
601 msgid ""
602 "The B<pthread_attr_init>()  function initializes the thread attributes "
603 "object pointed to by I<attr> with default attribute values.  After this "
604 "call, individual attributes of the object can be set using various related "
605 "functions (listed under SEE ALSO), and then the object can be used in one or "
606 "more B<pthread_create>(3)  calls that create threads."
607 msgstr ""
608
609 #. type: Plain text
610 #: build/C/man3/pthread_attr_init.3:55
611 msgid ""
612 "Calling B<pthread_attr_init>()  on a thread attributes object that has "
613 "already been initialized results in undefined behavior."
614 msgstr ""
615
616 #. type: Plain text
617 #: build/C/man3/pthread_attr_init.3:62
618 msgid ""
619 "When a thread attributes object is no longer required, it should be "
620 "destroyed using the B<pthread_attr_destroy>()  function.  Destroying a "
621 "thread attributes object has no effect on threads that were created using "
622 "that object."
623 msgstr ""
624
625 #. type: Plain text
626 #: build/C/man3/pthread_attr_init.3:68
627 msgid ""
628 "Once a thread attributes object has been destroyed, it can be reinitialized "
629 "using B<pthread_attr_init>().  Any other use of a destroyed thread "
630 "attributes object has undefined results."
631 msgstr ""
632
633 #. type: Plain text
634 #: build/C/man3/pthread_attr_init.3:71 build/C/man3/pthread_attr_setaffinity_np.3:79 build/C/man3/pthread_attr_setdetachstate.3:80 build/C/man3/pthread_attr_setguardsize.3:93 build/C/man3/pthread_attr_setinheritsched.3:96 build/C/man3/pthread_attr_setschedparam.3:88 build/C/man3/pthread_attr_setschedpolicy.3:86 build/C/man3/pthread_attr_setscope.3:106 build/C/man3/pthread_attr_setstack.3:88 build/C/man3/pthread_attr_setstackaddr.3:77 build/C/man3/pthread_attr_setstacksize.3:64 build/C/man3/pthread_setaffinity_np.3:80 build/C/man3/pthread_setcancelstate.3:95 build/C/man3/pthread_setname_np.3:75
635 msgid ""
636 "On success, these functions return 0; on error, they return a nonzero error "
637 "number."
638 msgstr ""
639
640 #. type: Plain text
641 #: build/C/man3/pthread_attr_init.3:79
642 msgid ""
643 "POSIX.1-2001 documents an B<ENOMEM> error for B<pthread_attr_init>(); on "
644 "Linux these functions always succeed (but portable and future-proof "
645 "applications should nevertheless handle a possible error return)."
646 msgstr ""
647
648 #. type: Plain text
649 #: build/C/man3/pthread_attr_init.3:81 build/C/man3/pthread_attr_setdetachstate.3:96 build/C/man3/pthread_attr_setguardsize.3:115 build/C/man3/pthread_attr_setinheritsched.3:119 build/C/man3/pthread_attr_setschedparam.3:109 build/C/man3/pthread_attr_setschedpolicy.3:109 build/C/man3/pthread_attr_setscope.3:128 build/C/man3/pthread_attr_setstack.3:121 build/C/man3/pthread_attr_setstacksize.3:92 build/C/man3/pthread_cancel.3:127 build/C/man3/pthread_cleanup_push.3:129 build/C/man3/pthread_create.3:155 build/C/man3/pthread_detach.3:66 build/C/man3/pthread_equal.3:54 build/C/man3/pthread_exit.3:82 build/C/man3/pthread_getcpuclockid.3:72 build/C/man3/pthread_join.3:100 build/C/man3/pthread_self.3:57 build/C/man3/pthread_setcancelstate.3:122 build/C/man3/pthread_setconcurrency.3:92 build/C/man3/pthread_setschedparam.3:150 build/C/man3/pthread_setschedprio.3:90 build/C/man3/pthread_sigmask.3:76 build/C/man3/pthread_testcancel.3:65
650 msgid "POSIX.1-2001."
651 msgstr ""
652
653 #. type: Plain text
654 #: build/C/man3/pthread_attr_init.3:87
655 msgid ""
656 "The I<pthread_attr_t> type should be treated as opaque: any access to the "
657 "object other than via pthreads functions is nonportable and produces "
658 "undefined results."
659 msgstr ""
660
661 #. type: Plain text
662 #: build/C/man3/pthread_attr_init.3:96
663 msgid ""
664 "The program below optionally makes use of B<pthread_attr_init>()  and "
665 "various related functions to initialize a thread attributes object that is "
666 "used to create a single thread.  Once created, the thread uses the "
667 "B<pthread_getattr_np>(3)  function (a nonstandard GNU extension) to retrieve "
668 "the thread's attributes, and then displays those attributes."
669 msgstr ""
670
671 #. type: Plain text
672 #: build/C/man3/pthread_attr_init.3:105
673 msgid ""
674 "If the program is run with no command-line argument, then it passes NULL as "
675 "the I<attr> argument of B<pthread_create>(3), so that the thread is created "
676 "with default attributes.  Running the program on Linux/x86-32 with the NPTL "
677 "threading implementation, we see the following:"
678 msgstr ""
679
680 #.  Results from glibc 2.8, SUSE 11.0; Oct 2008
681 #. type: Plain text
682 #: build/C/man3/pthread_attr_init.3:121
683 #, no-wrap
684 msgid ""
685 "$B< ulimit -s>       # No stack limit ==E<gt> default stack size is 2MB\n"
686 "unlimited\n"
687 "$B< ./a.out>\n"
688 "Thread attributes:\n"
689 "        Detach state        = PTHREAD_CREATE_JOINABLE\n"
690 "        Scope               = PTHREAD_SCOPE_SYSTEM\n"
691 "        Inherit scheduler   = PTHREAD_INHERIT_SCHED\n"
692 "        Scheduling policy   = SCHED_OTHER\n"
693 "        Scheduling priority = 0\n"
694 "        Guard size          = 4096 bytes\n"
695 "        Stack address       = 0x40196000\n"
696 "        Stack size          = 0x201000 bytes\n"
697 msgstr ""
698
699 #. type: Plain text
700 #: build/C/man3/pthread_attr_init.3:131
701 msgid ""
702 "When we supply a stack size as a command-line argument, the program "
703 "initializes a thread attributes object, sets various attributes in that "
704 "object, and passes a pointer to the object in the call to "
705 "B<pthread_create>(3).  Running the program on Linux/x86-32 with the NPTL "
706 "threading implementation, we see the following:"
707 msgstr ""
708
709 #.  Results from glibc 2.8, SUSE 11.0; Oct 2008
710 #. type: Plain text
711 #: build/C/man3/pthread_attr_init.3:146
712 #, no-wrap
713 msgid ""
714 "$B< ./a.out 0x3000000>\n"
715 "posix_memalign() allocated at 0x40197000\n"
716 "Thread attributes:\n"
717 "        Detach state        = PTHREAD_CREATE_DETACHED\n"
718 "        Scope               = PTHREAD_SCOPE_SYSTEM\n"
719 "        Inherit scheduler   = PTHREAD_EXPLICIT_SCHED\n"
720 "        Scheduling policy   = SCHED_OTHER\n"
721 "        Scheduling priority = 0\n"
722 "        Guard size          = 0 bytes\n"
723 "        Stack address       = 0x40197000\n"
724 "        Stack size          = 0x3000000 bytes\n"
725 msgstr ""
726
727 #. type: Plain text
728 #: build/C/man3/pthread_attr_init.3:157 build/C/man3/pthread_getattr_np.3:188
729 #, no-wrap
730 msgid ""
731 "#define _GNU_SOURCE     /* To get pthread_getattr_np() declaration */\n"
732 "#include E<lt>pthread.hE<gt>\n"
733 "#include E<lt>stdio.hE<gt>\n"
734 "#include E<lt>stdlib.hE<gt>\n"
735 "#include E<lt>unistd.hE<gt>\n"
736 "#include E<lt>errno.hE<gt>\n"
737 msgstr ""
738
739 #. type: Plain text
740 #: build/C/man3/pthread_attr_init.3:160 build/C/man3/pthread_cancel.3:162 build/C/man3/pthread_cleanup_push.3:243 build/C/man3/pthread_create.3:261 build/C/man3/pthread_getattr_np.3:191 build/C/man3/pthread_getcpuclockid.3:119 build/C/man3/pthread_setaffinity_np.3:179 build/C/man3/pthread_setschedparam.3:244 build/C/man3/pthread_sigmask.3:110
741 #, no-wrap
742 msgid ""
743 "#define handle_error_en(en, msg) \\e\n"
744 "        do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)\n"
745 msgstr ""
746
747 #. type: Plain text
748 #: build/C/man3/pthread_attr_init.3:168
749 #, no-wrap
750 msgid ""
751 "static void\n"
752 "display_pthread_attr(pthread_attr_t *attr, char *prefix)\n"
753 "{\n"
754 "    int s, i;\n"
755 "    size_t v;\n"
756 "    void *stkaddr;\n"
757 "    struct sched_param sp;\n"
758 msgstr ""
759
760 #. type: Plain text
761 #: build/C/man3/pthread_attr_init.3:176
762 #, no-wrap
763 msgid ""
764 "    s = pthread_attr_getdetachstate(attr, &i);\n"
765 "    if (s != 0)\n"
766 "        handle_error_en(s, \"pthread_attr_getdetachstate\");\n"
767 "    printf(\"%sDetach state        = %s\\en\", prefix,\n"
768 "            (i == PTHREAD_CREATE_DETACHED) ? \"PTHREAD_CREATE_DETACHED\" :\n"
769 "            (i == PTHREAD_CREATE_JOINABLE) ? \"PTHREAD_CREATE_JOINABLE\" :\n"
770 "            \"???\");\n"
771 msgstr ""
772
773 #. type: Plain text
774 #: build/C/man3/pthread_attr_init.3:184
775 #, no-wrap
776 msgid ""
777 "    s = pthread_attr_getscope(attr, &i);\n"
778 "    if (s != 0)\n"
779 "        handle_error_en(s, \"pthread_attr_getscope\");\n"
780 "    printf(\"%sScope               = %s\\en\", prefix,\n"
781 "            (i == PTHREAD_SCOPE_SYSTEM)  ? \"PTHREAD_SCOPE_SYSTEM\" :\n"
782 "            (i == PTHREAD_SCOPE_PROCESS) ? \"PTHREAD_SCOPE_PROCESS\" :\n"
783 "            \"???\");\n"
784 msgstr ""
785
786 #. type: Plain text
787 #: build/C/man3/pthread_attr_init.3:192
788 #, no-wrap
789 msgid ""
790 "    s = pthread_attr_getinheritsched(attr, &i);\n"
791 "    if (s != 0)\n"
792 "        handle_error_en(s, \"pthread_attr_getinheritsched\");\n"
793 "    printf(\"%sInherit scheduler   = %s\\en\", prefix,\n"
794 "            (i == PTHREAD_INHERIT_SCHED)  ? \"PTHREAD_INHERIT_SCHED\" :\n"
795 "            (i == PTHREAD_EXPLICIT_SCHED) ? \"PTHREAD_EXPLICIT_SCHED\" :\n"
796 "            \"???\");\n"
797 msgstr ""
798
799 #. type: Plain text
800 #: build/C/man3/pthread_attr_init.3:201
801 #, no-wrap
802 msgid ""
803 "    s = pthread_attr_getschedpolicy(attr, &i);\n"
804 "    if (s != 0)\n"
805 "        handle_error_en(s, \"pthread_attr_getschedpolicy\");\n"
806 "    printf(\"%sScheduling policy   = %s\\en\", prefix,\n"
807 "            (i == SCHED_OTHER) ? \"SCHED_OTHER\" :\n"
808 "            (i == SCHED_FIFO)  ? \"SCHED_FIFO\" :\n"
809 "            (i == SCHED_RR)    ? \"SCHED_RR\" :\n"
810 "            \"???\");\n"
811 msgstr ""
812
813 #. type: Plain text
814 #: build/C/man3/pthread_attr_init.3:206
815 #, no-wrap
816 msgid ""
817 "    s = pthread_attr_getschedparam(attr, &sp);\n"
818 "    if (s != 0)\n"
819 "        handle_error_en(s, \"pthread_attr_getschedparam\");\n"
820 "    printf(\"%sScheduling priority = %d\\en\", prefix, sp.sched_priority);\n"
821 msgstr ""
822
823 #. type: Plain text
824 #: build/C/man3/pthread_attr_init.3:211
825 #, no-wrap
826 msgid ""
827 "    s = pthread_attr_getguardsize(attr, &v);\n"
828 "    if (s != 0)\n"
829 "        handle_error_en(s, \"pthread_attr_getguardsize\");\n"
830 "    printf(\"%sGuard size          = %d bytes\\en\", prefix, v);\n"
831 msgstr ""
832
833 #. type: Plain text
834 #: build/C/man3/pthread_attr_init.3:218
835 #, no-wrap
836 msgid ""
837 "    s = pthread_attr_getstack(attr, &stkaddr, &v);\n"
838 "    if (s != 0)\n"
839 "        handle_error_en(s, \"pthread_attr_getstack\");\n"
840 "    printf(\"%sStack address       = %p\\en\", prefix, stkaddr);\n"
841 "    printf(\"%sStack size          = 0x%x bytes\\en\", prefix, v);\n"
842 "}\n"
843 msgstr ""
844
845 #. type: Plain text
846 #: build/C/man3/pthread_attr_init.3:224
847 #, no-wrap
848 msgid ""
849 "static void *\n"
850 "thread_start(void *arg)\n"
851 "{\n"
852 "    int s;\n"
853 "    pthread_attr_t gattr;\n"
854 msgstr ""
855
856 #. type: Plain text
857 #: build/C/man3/pthread_attr_init.3:228
858 #, no-wrap
859 msgid ""
860 "    /* pthread_getattr_np() is a non-standard GNU extension that\n"
861 "       retrieves the attributes of the thread specified in its\n"
862 "       first argument */\n"
863 msgstr ""
864
865 #. type: Plain text
866 #: build/C/man3/pthread_attr_init.3:232
867 #, no-wrap
868 msgid ""
869 "    s = pthread_getattr_np(pthread_self(), &gattr);\n"
870 "    if (s != 0)\n"
871 "        handle_error_en(s, \"pthread_getattr_np\");\n"
872 msgstr ""
873
874 #. type: Plain text
875 #: build/C/man3/pthread_attr_init.3:235
876 #, no-wrap
877 msgid ""
878 "    printf(\"Thread attributes:\\en\");\n"
879 "    display_pthread_attr(&gattr, \"\\et\");\n"
880 msgstr ""
881
882 #. type: Plain text
883 #: build/C/man3/pthread_attr_init.3:238 build/C/man3/pthread_getattr_np.3:240
884 #, no-wrap
885 msgid ""
886 "    exit(EXIT_SUCCESS);         /* Terminate all threads */\n"
887 "}\n"
888 msgstr ""
889
890 #. type: Plain text
891 #: build/C/man3/pthread_attr_init.3:246
892 #, no-wrap
893 msgid ""
894 "int\n"
895 "main(int argc, char *argv[])\n"
896 "{\n"
897 "    pthread_t thr;\n"
898 "    pthread_attr_t attr;\n"
899 "    pthread_attr_t *attrp;      /* NULL or &attr */\n"
900 "    int s;\n"
901 msgstr ""
902
903 #. type: Plain text
904 #: build/C/man3/pthread_attr_init.3:248 build/C/man3/pthread_setschedparam.3:362
905 #, no-wrap
906 msgid "    attrp = NULL;\n"
907 msgstr ""
908
909 #. type: Plain text
910 #: build/C/man3/pthread_attr_init.3:252
911 #, no-wrap
912 msgid ""
913 "    /* If a command-line argument was supplied, use it to set the\n"
914 "       stack-size attribute and set a few other thread attributes,\n"
915 "       and set attrp pointing to thread attributes object */\n"
916 msgstr ""
917
918 #. type: Plain text
919 #: build/C/man3/pthread_attr_init.3:256
920 #, no-wrap
921 msgid ""
922 "    if (argc E<gt> 1) {\n"
923 "        int stack_size;\n"
924 "        void *sp;\n"
925 msgstr ""
926
927 #. type: Plain text
928 #: build/C/man3/pthread_attr_init.3:258
929 #, no-wrap
930 msgid "        attrp = &attr;\n"
931 msgstr ""
932
933 #. type: Plain text
934 #: build/C/man3/pthread_attr_init.3:262
935 #, no-wrap
936 msgid ""
937 "        s = pthread_attr_init(&attr);\n"
938 "        if (s != 0)\n"
939 "            handle_error_en(s, \"pthread_attr_init\");\n"
940 msgstr ""
941
942 #. type: Plain text
943 #: build/C/man3/pthread_attr_init.3:266
944 #, no-wrap
945 msgid ""
946 "        s = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);\n"
947 "        if (s != 0)\n"
948 "            handle_error_en(s, \"pthread_attr_setdetachstate\");\n"
949 msgstr ""
950
951 #. type: Plain text
952 #: build/C/man3/pthread_attr_init.3:270
953 #, no-wrap
954 msgid ""
955 "        s = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);\n"
956 "        if (s != 0)\n"
957 "            handle_error_en(s, \"pthread_attr_setinheritsched\");\n"
958 msgstr ""
959
960 #. type: Plain text
961 #: build/C/man3/pthread_attr_init.3:272
962 #, no-wrap
963 msgid "        stack_size = strtoul(argv[1], NULL, 0);\n"
964 msgstr ""
965
966 #. type: Plain text
967 #: build/C/man3/pthread_attr_init.3:276
968 #, no-wrap
969 msgid ""
970 "        s = posix_memalign(&sp, sysconf(_SC_PAGESIZE), stack_size);\n"
971 "        if (s != 0)\n"
972 "            handle_error_en(s, \"posix_memalign\");\n"
973 msgstr ""
974
975 #. type: Plain text
976 #: build/C/man3/pthread_attr_init.3:278
977 #, no-wrap
978 msgid "        printf(\"posix_memalign() allocated at %p\\en\", sp);\n"
979 msgstr ""
980
981 #. type: Plain text
982 #: build/C/man3/pthread_attr_init.3:283
983 #, no-wrap
984 msgid ""
985 "        s = pthread_attr_setstack(&attr, sp, stack_size);\n"
986 "        if (s != 0)\n"
987 "            handle_error_en(s, \"pthread_attr_setstack\");\n"
988 "    }\n"
989 msgstr ""
990
991 #. type: Plain text
992 #: build/C/man3/pthread_attr_init.3:287 build/C/man3/pthread_getattr_np.3:335
993 #, no-wrap
994 msgid ""
995 "    s = pthread_create(&thr, attrp, &thread_start, NULL);\n"
996 "    if (s != 0)\n"
997 "        handle_error_en(s, \"pthread_create\");\n"
998 msgstr ""
999
1000 #. type: Plain text
1001 #: build/C/man3/pthread_attr_init.3:293 build/C/man3/pthread_getattr_np.3:341
1002 #, no-wrap
1003 msgid ""
1004 "    if (attrp != NULL) {\n"
1005 "        s = pthread_attr_destroy(attrp);\n"
1006 "        if (s != 0)\n"
1007 "            handle_error_en(s, \"pthread_attr_destroy\");\n"
1008 "    }\n"
1009 msgstr ""
1010
1011 #. type: Plain text
1012 #: build/C/man3/pthread_attr_init.3:296 build/C/man3/pthread_getattr_np.3:344
1013 #, no-wrap
1014 msgid ""
1015 "    pause();    /* Terminates when other thread calls exit() */\n"
1016 "}\n"
1017 msgstr ""
1018
1019 #. type: Plain text
1020 #: build/C/man3/pthread_attr_init.3:312
1021 msgid ""
1022 "B<pthread_attr_setaffinity_np>(3), B<pthread_attr_setdetachstate>(3), "
1023 "B<pthread_attr_setguardsize>(3), B<pthread_attr_setinheritsched>(3), "
1024 "B<pthread_attr_setschedparam>(3), B<pthread_attr_setschedpolicy>(3), "
1025 "B<pthread_attr_setscope>(3), B<pthread_attr_setstack>(3), "
1026 "B<pthread_attr_setstackaddr>(3), B<pthread_attr_setstacksize>(3), "
1027 "B<pthread_create>(3), B<pthread_getattr_np>(3), B<pthreads>(7)"
1028 msgstr ""
1029
1030 #. type: TH
1031 #: build/C/man3/pthread_attr_setaffinity_np.3:26
1032 #, no-wrap
1033 msgid "PTHREAD_ATTR_SETAFFINITY_NP"
1034 msgstr ""
1035
1036 #. type: Plain text
1037 #: build/C/man3/pthread_attr_setaffinity_np.3:30
1038 msgid ""
1039 "pthread_attr_setaffinity_np, pthread_attr_getaffinity_np - set/get CPU "
1040 "affinity attribute in thread attributes object"
1041 msgstr ""
1042
1043 #. type: Plain text
1044 #: build/C/man3/pthread_attr_setaffinity_np.3:34 build/C/man3/pthread_getattr_np.3:33 build/C/man3/pthread_setaffinity_np.3:34 build/C/man3/pthread_tryjoin_np.3:34 build/C/man3/pthread_yield.3:32
1045 #, no-wrap
1046 msgid ""
1047 "B<#define _GNU_SOURCE>             /* See feature_test_macros(7) */\n"
1048 "B<#include E<lt>pthread.hE<gt>>\n"
1049 msgstr ""
1050
1051 #. type: Plain text
1052 #: build/C/man3/pthread_attr_setaffinity_np.3:39
1053 #, no-wrap
1054 msgid ""
1055 "B<int pthread_attr_setaffinity_np(pthread_attr_t *>I<attr>B<,>\n"
1056 "B<                   size_t >I<cpusetsize>B<, const cpu_set_t "
1057 "*>I<cpuset>B<);>\n"
1058 "B<int pthread_attr_getaffinity_np(const pthread_attr_t *>I<attr>B<,>\n"
1059 "B<                   size_t >I<cpusetsize>B<, cpu_set_t *>I<cpuset>B<);>\n"
1060 msgstr ""
1061
1062 #. type: Plain text
1063 #: build/C/man3/pthread_attr_setaffinity_np.3:54
1064 msgid ""
1065 "The B<pthread_attr_setaffinity_np>()  function sets the CPU affinity mask "
1066 "attribute of the thread attributes object referred to by I<attr> to the "
1067 "value specified in I<cpuset>.  This attribute determines the CPU affinity "
1068 "mask of a thread created using the thread attributes object I<attr>."
1069 msgstr ""
1070
1071 #. type: Plain text
1072 #: build/C/man3/pthread_attr_setaffinity_np.3:63
1073 msgid ""
1074 "The B<pthread_attr_getaffinity_np>()  function returns the CPU affinity mask "
1075 "attribute of the thread attributes object referred to by I<attr> in the "
1076 "buffer pointed to by I<cpuset>."
1077 msgstr ""
1078
1079 #. type: Plain text
1080 #: build/C/man3/pthread_attr_setaffinity_np.3:70
1081 msgid ""
1082 "The argument I<cpusetsize> is the length (in bytes) of the buffer pointed to "
1083 "by I<cpuset>.  Typically, this argument would be specified as "
1084 "I<sizeof(cpu_set_t)>."
1085 msgstr ""
1086
1087 #. type: Plain text
1088 #: build/C/man3/pthread_attr_setaffinity_np.3:76 build/C/man3/pthread_setaffinity_np.3:67
1089 msgid ""
1090 "For more details on CPU affinity masks, see B<sched_setaffinity>(2).  For a "
1091 "description of a set of macros that can be used to manipulate and inspect "
1092 "CPU sets, see B<CPU_SET>(3)."
1093 msgstr ""
1094
1095 #. type: TP
1096 #: build/C/man3/pthread_attr_setaffinity_np.3:80 build/C/man3/pthread_attr_setaffinity_np.3:92 build/C/man3/pthread_attr_setdetachstate.3:83 build/C/man3/pthread_attr_setinheritsched.3:99 build/C/man3/pthread_attr_setschedpolicy.3:89 build/C/man3/pthread_attr_setscope.3:109 build/C/man3/pthread_attr_setstack.3:91 build/C/man3/pthread_attr_setstacksize.3:67 build/C/man3/pthread_create.3:144 build/C/man3/pthread_detach.3:55 build/C/man3/pthread_join.3:85 build/C/man3/pthread_join.3:89 build/C/man3/pthread_kill.3:69 build/C/man3/pthread_rwlockattr_setkind_np.3:105 build/C/man3/pthread_setaffinity_np.3:84 build/C/man3/pthread_setaffinity_np.3:93 build/C/man3/pthread_setaffinity_np.3:109 build/C/man3/pthread_setcancelstate.3:99 build/C/man3/pthread_setcancelstate.3:107 build/C/man3/pthread_setconcurrency.3:71 build/C/man3/pthread_setschedparam.3:122 build/C/man3/pthread_setschedprio.3:62 build/C/man3/pthread_sigqueue.3:78 build/C/man3/pthread_tryjoin_np.3:106
1097 #, no-wrap
1098 msgid "B<EINVAL>"
1099 msgstr ""
1100
1101 #.  cpumask_t
1102 #.  The raw sched_getaffinity() system call returns the size (in bytes)
1103 #.  of the cpumask_t type.
1104 #. type: Plain text
1105 #: build/C/man3/pthread_attr_setaffinity_np.3:92
1106 msgid ""
1107 "(B<pthread_attr_setaffinity_np>())  I<cpuset> specified a CPU that was "
1108 "outside the set supported by the kernel.  (The kernel configuration option "
1109 "B<CONFIG_NR_CPUS> defines the range of the set supported by the kernel data "
1110 "type used to represent CPU sets.)"
1111 msgstr ""
1112
1113 #. type: Plain text
1114 #: build/C/man3/pthread_attr_setaffinity_np.3:102
1115 msgid ""
1116 "(B<pthread_attr_getaffinity_np>())  A CPU in the affinity mask of the thread "
1117 "attributes object referred to by I<attr> lies outside the range specified by "
1118 "I<cpusetsize> (i.e., I<cpuset>/I<cpusetsize> is too small)."
1119 msgstr ""
1120
1121 #. type: Plain text
1122 #: build/C/man3/pthread_attr_setaffinity_np.3:106
1123 msgid "(B<pthread_attr_setaffinity_np>())  Could not allocate memory."
1124 msgstr ""
1125
1126 #. type: Plain text
1127 #: build/C/man3/pthread_attr_setaffinity_np.3:108 build/C/man3/pthread_setaffinity_np.3:121
1128 msgid "These functions are provided by glibc since version 2.3.4."
1129 msgstr ""
1130
1131 #. type: Plain text
1132 #: build/C/man3/pthread_attr_setaffinity_np.3:111 build/C/man3/pthread_cleanup_push_defer_np.3:117 build/C/man3/pthread_setaffinity_np.3:131 build/C/man3/pthread_tryjoin_np.3:123
1133 msgid ""
1134 "These functions are nonstandard GNU extensions; hence the suffix \"_np\" "
1135 "(nonportable) in the names."
1136 msgstr ""
1137
1138 #. type: Plain text
1139 #: build/C/man3/pthread_attr_setaffinity_np.3:118 build/C/man3/pthread_setaffinity_np.3:157
1140 msgid ""
1141 "In glibc 2.3.3 only, versions of these functions were provided that did not "
1142 "have a I<cpusetsize> argument.  Instead the CPU set size given to the "
1143 "underlying system calls was always I<sizeof(cpu_set_t)>."
1144 msgstr ""
1145
1146 #. type: Plain text
1147 #: build/C/man3/pthread_attr_setaffinity_np.3:123
1148 msgid ""
1149 "B<sched_setaffinity>(2), B<pthread_attr_init>(3), "
1150 "B<pthread_setaffinity_np>(3), B<cpuset>(7), B<pthreads>(7)"
1151 msgstr ""
1152
1153 #. type: TH
1154 #: build/C/man3/pthread_attr_setdetachstate.3:26
1155 #, no-wrap
1156 msgid "PTHREAD_ATTR_SETDETACHSTATE"
1157 msgstr ""
1158
1159 #. type: Plain text
1160 #: build/C/man3/pthread_attr_setdetachstate.3:30
1161 msgid ""
1162 "pthread_attr_setdetachstate, pthread_attr_getdetachstate - set/get detach "
1163 "state attribute in thread attributes object"
1164 msgstr ""
1165
1166 #. type: Plain text
1167 #: build/C/man3/pthread_attr_setdetachstate.3:38
1168 #, no-wrap
1169 msgid ""
1170 "B<int pthread_attr_setdetachstate(pthread_attr_t *>I<attr>B<, int "
1171 ">I<detachstate>B<);>\n"
1172 "B<int pthread_attr_getdetachstate(const pthread_attr_t *>I<attr>B<, int "
1173 "*>I<detachstate>B<);>\n"
1174 msgstr ""
1175
1176 #. type: Plain text
1177 #: build/C/man3/pthread_attr_setdetachstate.3:53
1178 msgid ""
1179 "The B<pthread_attr_setdetachstate>()  function sets the detach state "
1180 "attribute of the thread attributes object referred to by I<attr> to the "
1181 "value specified in I<detachstate>.  The detach state attribute determines "
1182 "whether a thread created using the thread attributes object I<attr> will be "
1183 "created in a joinable or a detached state."
1184 msgstr ""
1185
1186 #. type: Plain text
1187 #: build/C/man3/pthread_attr_setdetachstate.3:56
1188 msgid "The following values may be specified in I<detachstate>:"
1189 msgstr ""
1190
1191 #. type: TP
1192 #: build/C/man3/pthread_attr_setdetachstate.3:56
1193 #, no-wrap
1194 msgid "B<PTHREAD_CREATE_DETACHED>"
1195 msgstr ""
1196
1197 #. type: Plain text
1198 #: build/C/man3/pthread_attr_setdetachstate.3:61
1199 msgid "Threads that are created using I<attr> will be created in a detached state."
1200 msgstr ""
1201
1202 #. type: TP
1203 #: build/C/man3/pthread_attr_setdetachstate.3:61
1204 #, no-wrap
1205 msgid "B<PTHREAD_CREATE_JOINABLE>"
1206 msgstr ""
1207
1208 #. type: Plain text
1209 #: build/C/man3/pthread_attr_setdetachstate.3:66
1210 msgid "Threads that are created using I<attr> will be created in a joinable state."
1211 msgstr ""
1212
1213 #. type: Plain text
1214 #: build/C/man3/pthread_attr_setdetachstate.3:70
1215 msgid ""
1216 "The default setting of the detach state attribute in a newly initialized "
1217 "thread attributes object is B<PTHREAD_CREATE_JOINABLE>."
1218 msgstr ""
1219
1220 #. type: Plain text
1221 #: build/C/man3/pthread_attr_setdetachstate.3:77
1222 msgid ""
1223 "The B<pthread_attr_getdetachstate>()  returns the detach state attribute of "
1224 "the thread attributes object I<attr> in the buffer pointed to by "
1225 "I<detachstate>."
1226 msgstr ""
1227
1228 #. type: Plain text
1229 #: build/C/man3/pthread_attr_setdetachstate.3:83
1230 msgid "B<pthread_attr_setdetachstate>()  can fail with the following error:"
1231 msgstr ""
1232
1233 #. type: Plain text
1234 #: build/C/man3/pthread_attr_setdetachstate.3:87
1235 msgid "An invalid value was specified in I<detachstate>."
1236 msgstr ""
1237
1238 #. type: Plain text
1239 #: build/C/man3/pthread_attr_setdetachstate.3:94
1240 msgid ""
1241 "The B<pthread_attr_setdetachstate>()  and B<pthread_attr_getdetachstate>()  "
1242 "functions are thread-safe."
1243 msgstr ""
1244
1245 #. type: Plain text
1246 #: build/C/man3/pthread_attr_setdetachstate.3:100
1247 msgid "See B<pthread_create>(3)  for more details on detached and joinable threads."
1248 msgstr ""
1249
1250 #. type: Plain text
1251 #: build/C/man3/pthread_attr_setdetachstate.3:108
1252 msgid ""
1253 "A thread that is created in a joinable state should eventually either be "
1254 "joined using B<pthread_join>(3)  or detached using B<pthread_detach>(3); see "
1255 "B<pthread_create>(3)."
1256 msgstr ""
1257
1258 #. type: Plain text
1259 #: build/C/man3/pthread_attr_setdetachstate.3:115
1260 msgid ""
1261 "It is an error to specify the thread ID of a thread that was created in a "
1262 "detached state in a later call to B<pthread_detach>(3)  or "
1263 "B<pthread_join>(3)."
1264 msgstr ""
1265
1266 #. type: Plain text
1267 #: build/C/man3/pthread_attr_setdetachstate.3:118 build/C/man3/pthread_attr_setstack.3:162
1268 msgid "See B<pthread_attr_init>(3)."
1269 msgstr ""
1270
1271 #. type: Plain text
1272 #: build/C/man3/pthread_attr_setdetachstate.3:123
1273 msgid ""
1274 "B<pthread_attr_init>(3), B<pthread_create>(3), B<pthread_detach>(3), "
1275 "B<pthread_join>(3), B<pthreads>(7)"
1276 msgstr ""
1277
1278 #. type: TH
1279 #: build/C/man3/pthread_attr_setguardsize.3:26
1280 #, no-wrap
1281 msgid "PTHREAD_ATTR_SETGUARDSIZE"
1282 msgstr ""
1283
1284 #. type: Plain text
1285 #: build/C/man3/pthread_attr_setguardsize.3:30
1286 msgid ""
1287 "pthread_attr_setguardsize, pthread_attr_getguardsize - set/get guard size "
1288 "attribute in thread attributes object"
1289 msgstr ""
1290
1291 #. type: Plain text
1292 #: build/C/man3/pthread_attr_setguardsize.3:38
1293 #, no-wrap
1294 msgid ""
1295 "B<int pthread_attr_setguardsize(pthread_attr_t *>I<attr>B<, size_t "
1296 ">I<guardsize>B<);>\n"
1297 "B<int pthread_attr_getguardsize(const pthread_attr_t *>I<attr>B<, size_t "
1298 "*>I<guardsize>B<);>\n"
1299 msgstr ""
1300
1301 #. type: Plain text
1302 #: build/C/man3/pthread_attr_setguardsize.3:49
1303 msgid ""
1304 "The B<pthread_attr_setguardsize>()  function sets the guard size attribute "
1305 "of the thread attributes object referred to by I<attr> to the value "
1306 "specified in I<guardsize>."
1307 msgstr ""
1308
1309 #. type: Plain text
1310 #: build/C/man3/pthread_attr_setguardsize.3:59
1311 msgid ""
1312 "If I<guardsize> is greater than 0, then for each new thread created using "
1313 "I<attr> the system allocates an additional region of at least I<guardsize> "
1314 "bytes at the end of the thread's stack to act as the guard area for the "
1315 "stack (but see BUGS)."
1316 msgstr ""
1317
1318 #. type: Plain text
1319 #: build/C/man3/pthread_attr_setguardsize.3:65
1320 msgid ""
1321 "If I<guardsize> is 0, then new threads created with I<attr> will not have a "
1322 "guard area."
1323 msgstr ""
1324
1325 #. type: Plain text
1326 #: build/C/man3/pthread_attr_setguardsize.3:67
1327 msgid "The default guard size is the same as the system page size."
1328 msgstr ""
1329
1330 #. type: Plain text
1331 #: build/C/man3/pthread_attr_setguardsize.3:82
1332 msgid ""
1333 "If the stack address attribute has been set in I<attr> (using "
1334 "B<pthread_attr_setstack>(3)  or B<pthread_attr_setstackaddr>(3)), meaning "
1335 "that the caller is allocating the thread's stack, then the guard size "
1336 "attribute is ignored (i.e., no guard area is created by the system): it is "
1337 "the application's responsibility to handle stack overflow (perhaps by using "
1338 "B<mprotect>(2)  to manually define a guard area at the end of the stack that "
1339 "it has allocated)."
1340 msgstr ""
1341
1342 #. type: Plain text
1343 #: build/C/man3/pthread_attr_setguardsize.3:90
1344 msgid ""
1345 "The B<pthread_attr_getguardsize>()  function returns the guard size "
1346 "attribute of the thread attributes object referred to by I<attr> in the "
1347 "buffer pointed to by I<guardsize>."
1348 msgstr ""
1349
1350 #. type: Plain text
1351 #: build/C/man3/pthread_attr_setguardsize.3:104
1352 msgid ""
1353 "POSIX.1-2001 documents an B<EINVAL> error if I<attr> or I<guardsize> is "
1354 "invalid.  On Linux these functions always succeed (but portable and "
1355 "future-proof applications should nevertheless handle a possible error "
1356 "return)."
1357 msgstr ""
1358
1359 #. type: Plain text
1360 #: build/C/man3/pthread_attr_setguardsize.3:106 build/C/man3/pthread_attr_setstackaddr.3:83 build/C/man3/pthread_attr_setstacksize.3:83
1361 msgid "These functions are provided by glibc since version 2.1."
1362 msgstr ""
1363
1364 #. type: Plain text
1365 #: build/C/man3/pthread_attr_setguardsize.3:113
1366 msgid ""
1367 "The B<pthread_attr_setguardsize>()  and B<pthread_attr_getguardsize>()  "
1368 "functions are thread-safe."
1369 msgstr ""
1370
1371 #. type: Plain text
1372 #: build/C/man3/pthread_attr_setguardsize.3:129
1373 msgid ""
1374 "A guard area consists of virtual memory pages that are protected to prevent "
1375 "read and write access.  If a thread overflows its stack into the guard area, "
1376 "then, on most hard architectures, it receives a B<SIGSEGV> signal, thus "
1377 "notifying it of the overflow.  Guard areas start on page boundaries, and the "
1378 "guard size is internally rounded up to the system page size when creating a "
1379 "thread.  (Nevertheless, B<pthread_attr_getguardsize>()  returns the guard "
1380 "size that was set by B<pthread_attr_setguardsize>().)"
1381 msgstr ""
1382
1383 #. type: Plain text
1384 #: build/C/man3/pthread_attr_setguardsize.3:133
1385 msgid ""
1386 "Setting a guard size of 0 may be useful to save memory in an application "
1387 "that creates many threads and knows that stack overflow can never occur."
1388 msgstr ""
1389
1390 #. type: Plain text
1391 #: build/C/man3/pthread_attr_setguardsize.3:137
1392 msgid ""
1393 "Choosing a guard size larger than the default size may be necessary for "
1394 "detecting stack overflows if a thread allocates large data structures on the "
1395 "stack."
1396 msgstr ""
1397
1398 #. type: SH
1399 #: build/C/man3/pthread_attr_setguardsize.3:137 build/C/man3/pthread_attr_setinheritsched.3:119 build/C/man3/pthread_attr_setstacksize.3:103 build/C/man3/pthread_create.3:203 build/C/man3/pthread_exit.3:98 build/C/man3/pthread_rwlockattr_setkind_np.3:109
1400 #, no-wrap
1401 msgid "BUGS"
1402 msgstr ""
1403
1404 #. type: Plain text
1405 #: build/C/man3/pthread_attr_setguardsize.3:148
1406 msgid ""
1407 "As at glibc 2.8, the NPTL threading implementation includes the guard area "
1408 "within the stack size allocation, rather than allocating extra space at the "
1409 "end of the stack, as POSIX.1 requires.  (This can result in an B<EINVAL> "
1410 "error from B<pthread_create>(3)  if the guard size value is too large, "
1411 "leaving no space for the actual stack.)"
1412 msgstr ""
1413
1414 #.  glibc includes the guardsize within the allocated stack size,
1415 #.  which looks pretty clearly to be in violation of POSIX.
1416 #
1417 #.  Filed bug, 22 Oct 2008:
1418 #.  http://sources.redhat.com/bugzilla/show_bug.cgi?id=6973
1419 #
1420 #.  Older reports:
1421 #.  https//bugzilla.redhat.com/show_bug.cgi?id=435337
1422 #.  Reportedly, LinuxThreads did the right thing, allocating
1423 #.  extra space at the end of the stack:
1424 #.  http://sourceware.org/ml/libc-alpha/2008-05/msg00086.html
1425 #. type: Plain text
1426 #: build/C/man3/pthread_attr_setguardsize.3:162
1427 msgid ""
1428 "The obsolete LinuxThreads implementation did the right thing, allocating "
1429 "extra space at the end of the stack for the guard area."
1430 msgstr ""
1431
1432 #. type: Plain text
1433 #: build/C/man3/pthread_attr_setguardsize.3:165
1434 msgid "See B<pthread_getattr_np>(3)."
1435 msgstr ""
1436
1437 #. type: Plain text
1438 #: build/C/man3/pthread_attr_setguardsize.3:172
1439 msgid ""
1440 "B<mmap>(2), B<mprotect>(2), B<pthread_attr_init>(3), "
1441 "B<pthread_attr_setstack>(3), B<pthread_attr_setstacksize>(3), "
1442 "B<pthread_create>(3), B<pthreads>(7)"
1443 msgstr ""
1444
1445 #. type: TH
1446 #: build/C/man3/pthread_attr_setinheritsched.3:26
1447 #, no-wrap
1448 msgid "PTHREAD_ATTR_SETINHERITSCHED"
1449 msgstr ""
1450
1451 #. type: TH
1452 #: build/C/man3/pthread_attr_setinheritsched.3:26 build/C/man3/pthread_attr_setschedparam.3:26 build/C/man3/pthread_attr_setschedpolicy.3:26 build/C/man7/pthreads.7:26
1453 #, no-wrap
1454 msgid "2014-05-21"
1455 msgstr ""
1456
1457 #. type: Plain text
1458 #: build/C/man3/pthread_attr_setinheritsched.3:30
1459 msgid ""
1460 "pthread_attr_setinheritsched, pthread_attr_getinheritsched - set/get "
1461 "inherit-scheduler attribute in thread attributes object"
1462 msgstr ""
1463
1464 #. type: Plain text
1465 #: build/C/man3/pthread_attr_setinheritsched.3:38
1466 #, no-wrap
1467 msgid ""
1468 "B<int pthread_attr_setinheritsched(pthread_attr_t *>I<attr>B<,>\n"
1469 "B<                                 int >I<inheritsched>B<);>\n"
1470 "B<int pthread_attr_getinheritsched(const pthread_attr_t *>I<attr>B<,>\n"
1471 "B<                                 int *>I<inheritsched>B<);>\n"
1472 msgstr ""
1473
1474 #. type: Plain text
1475 #: build/C/man3/pthread_attr_setinheritsched.3:55
1476 msgid ""
1477 "The B<pthread_attr_setinheritsched>()  function sets the inherit-scheduler "
1478 "attribute of the thread attributes object referred to by I<attr> to the "
1479 "value specified in I<inheritsched>.  The inherit-scheduler attribute "
1480 "determines whether a thread created using the thread attributes object "
1481 "I<attr> will inherit its scheduling attributes from the calling thread or "
1482 "whether it will take them from I<attr>."
1483 msgstr ""
1484
1485 #. type: Plain text
1486 #: build/C/man3/pthread_attr_setinheritsched.3:64
1487 msgid ""
1488 "The following scheduling attributes are affected by the inherit-scheduler "
1489 "attribute: scheduling policy (B<pthread_attr_setschedpolicy>(3)), scheduling "
1490 "priority (B<pthread_attr_setschedparam>(3)), and contention scope "
1491 "(B<pthread_attr_setscope>(3))."
1492 msgstr ""
1493
1494 #. type: Plain text
1495 #: build/C/man3/pthread_attr_setinheritsched.3:67
1496 msgid "The following values may be specified in I<inheritsched>:"
1497 msgstr ""
1498
1499 #. type: TP
1500 #: build/C/man3/pthread_attr_setinheritsched.3:67
1501 #, no-wrap
1502 msgid "B<PTHREAD_INHERIT_SCHED>"
1503 msgstr ""
1504
1505 #. type: Plain text
1506 #: build/C/man3/pthread_attr_setinheritsched.3:75
1507 msgid ""
1508 "Threads that are created using I<attr> inherit scheduling attributes from "
1509 "the creating thread; the scheduling attributes in I<attr> are ignored."
1510 msgstr ""
1511
1512 #. type: TP
1513 #: build/C/man3/pthread_attr_setinheritsched.3:75
1514 #, no-wrap
1515 msgid "B<PTHREAD_EXPLICIT_SCHED>"
1516 msgstr ""
1517
1518 #.  FIXME Document the defaults for scheduler settings
1519 #. type: Plain text
1520 #: build/C/man3/pthread_attr_setinheritsched.3:82
1521 msgid ""
1522 "Threads that are created using I<attr> take their scheduling attributes from "
1523 "the values specified by the attributes object."
1524 msgstr ""
1525
1526 #. type: Plain text
1527 #: build/C/man3/pthread_attr_setinheritsched.3:86
1528 msgid ""
1529 "The default setting of the inherit-scheduler attribute in a newly "
1530 "initialized thread attributes object is B<PTHREAD_INHERIT_SCHED>."
1531 msgstr ""
1532
1533 #. type: Plain text
1534 #: build/C/man3/pthread_attr_setinheritsched.3:93
1535 msgid ""
1536 "The B<pthread_attr_getinheritsched>()  returns the inherit-scheduler "
1537 "attribute of the thread attributes object I<attr> in the buffer pointed to "
1538 "by I<inheritsched>."
1539 msgstr ""
1540
1541 #. type: Plain text
1542 #: build/C/man3/pthread_attr_setinheritsched.3:99
1543 msgid "B<pthread_attr_setinheritsched>()  can fail with the following error:"
1544 msgstr ""
1545
1546 #. type: Plain text
1547 #: build/C/man3/pthread_attr_setinheritsched.3:103
1548 msgid "Invalid value in I<inheritsched>."
1549 msgstr ""
1550
1551 #.  .SH VERSIONS
1552 #.  Available since glibc 2.0.
1553 #. type: Plain text
1554 #: build/C/man3/pthread_attr_setinheritsched.3:110
1555 msgid ""
1556 "POSIX.1-2001 also documents an optional B<ENOTSUP> error (\"attempt was made "
1557 "to set the attribute to an unsupported value\") for "
1558 "B<pthread_attr_setinheritsched>()."
1559 msgstr ""
1560
1561 #. type: Plain text
1562 #: build/C/man3/pthread_attr_setinheritsched.3:117
1563 msgid ""
1564 "The B<pthread_attr_setinheritsched>()  and B<pthread_attr_getinheritsched>()  "
1565 "functions are thread-safe."
1566 msgstr ""
1567
1568 #.  FIXME . Track status of the following bug:
1569 #.  http://sourceware.org/bugzilla/show_bug.cgi?id=7007
1570 #. type: Plain text
1571 #: build/C/man3/pthread_attr_setinheritsched.3:135
1572 msgid ""
1573 "As at glibc 2.8, if a thread attributes object is initialized using "
1574 "B<pthread_attr_init>(3), then the scheduling policy of the attributes object "
1575 "is set to B<SCHED_OTHER> and the scheduling priority is set to 0.  However, "
1576 "if the inherit-scheduler attribute is then set to B<PTHREAD_EXPLICIT_SCHED>, "
1577 "then a thread created using the attribute object wrongly inherits its "
1578 "scheduling attributes from the creating thread.  This bug does not occur if "
1579 "either the scheduling policy or scheduling priority attribute is explicitly "
1580 "set in the thread attributes object before calling B<pthread_create>(3)."
1581 msgstr ""
1582
1583 #. type: Plain text
1584 #: build/C/man3/pthread_attr_setinheritsched.3:138 build/C/man3/pthread_attr_setschedparam.3:116 build/C/man3/pthread_attr_setschedpolicy.3:112
1585 msgid "See B<pthread_setschedparam>(3)."
1586 msgstr ""
1587
1588 #. type: Plain text
1589 #: build/C/man3/pthread_attr_setinheritsched.3:149
1590 msgid ""
1591 "B<pthread_attr_init>(3), B<pthread_attr_setschedparam>(3), "
1592 "B<pthread_attr_setschedpolicy>(3), B<pthread_attr_setscope>(3), "
1593 "B<pthread_create>(3), B<pthread_setschedparam>(3), "
1594 "B<pthread_setschedprio>(3), B<pthreads>(7), B<sched>(7)"
1595 msgstr ""
1596
1597 #. type: TH
1598 #: build/C/man3/pthread_attr_setschedparam.3:26
1599 #, no-wrap
1600 msgid "PTHREAD_ATTR_SETSCHEDPARAM"
1601 msgstr ""
1602
1603 #. type: Plain text
1604 #: build/C/man3/pthread_attr_setschedparam.3:30
1605 msgid ""
1606 "pthread_attr_setschedparam, pthread_attr_getschedparam - set/get scheduling "
1607 "parameter attributes in thread attributes object"
1608 msgstr ""
1609
1610 #. type: Plain text
1611 #: build/C/man3/pthread_attr_setschedparam.3:38
1612 #, no-wrap
1613 msgid ""
1614 "B<int pthread_attr_setschedparam(pthread_attr_t *>I<attr>B<,>\n"
1615 "B<                               const struct sched_param *>I<param>B<);>\n"
1616 "B<int pthread_attr_getschedparam(const pthread_attr_t *>I<attr>B<,>\n"
1617 "B<                               struct sched_param *>I<param>B<);>\n"
1618 msgstr ""
1619
1620 #. type: Plain text
1621 #: build/C/man3/pthread_attr_setschedparam.3:52
1622 msgid ""
1623 "The B<pthread_attr_setschedparam>()  function sets the scheduling parameter "
1624 "attributes of the thread attributes object referred to by I<attr> to the "
1625 "values specified in the buffer pointed to by I<param>.  These attributes "
1626 "determine the scheduling parameters of a thread created using the thread "
1627 "attributes object I<attr>."
1628 msgstr ""
1629
1630 #. type: Plain text
1631 #: build/C/man3/pthread_attr_setschedparam.3:59
1632 msgid ""
1633 "The B<pthread_attr_getschedparam>()  returns the scheduling parameter "
1634 "attributes of the thread attributes object I<attr> in the buffer pointed to "
1635 "by I<param>."
1636 msgstr ""
1637
1638 #. type: Plain text
1639 #: build/C/man3/pthread_attr_setschedparam.3:61
1640 msgid "Scheduling parameters are maintained in the following structure:"
1641 msgstr ""
1642
1643 #. type: Plain text
1644 #: build/C/man3/pthread_attr_setschedparam.3:67 build/C/man3/pthread_setschedparam.3:69
1645 #, no-wrap
1646 msgid ""
1647 "struct sched_param {\n"
1648 "    int sched_priority;     /* Scheduling priority */\n"
1649 "};\n"
1650 msgstr ""
1651
1652 #. type: Plain text
1653 #: build/C/man3/pthread_attr_setschedparam.3:74 build/C/man3/pthread_setschedparam.3:76
1654 msgid ""
1655 "As can be seen, only one scheduling parameter is supported.  For details of "
1656 "the permitted ranges for scheduling priorities in each scheduling policy, "
1657 "see B<sched>(7)."
1658 msgstr ""
1659
1660 #. type: Plain text
1661 #: build/C/man3/pthread_attr_setschedparam.3:85
1662 msgid ""
1663 "In order for the parameter setting made by B<pthread_attr_setschedparam>()  "
1664 "to have effect when calling B<pthread_create>(3), the caller must use "
1665 "B<pthread_attr_setinheritsched>(3)  to set the inherit-scheduler attribute "
1666 "of the attributes object I<attr> to B<PTHREAD_EXPLICIT_SCHED>."
1667 msgstr ""
1668
1669 #.  .SH VERSIONS
1670 #.  Available since glibc 2.0.
1671 #. type: Plain text
1672 #: build/C/man3/pthread_attr_setschedparam.3:100
1673 msgid ""
1674 "POSIX.1 documents B<EINVAL> and B<ENOTSUP> errors for "
1675 "B<pthread_attr_setschedparam>().  On Linux these functions always succeed "
1676 "(but portable and future-proof applications should nevertheless handle a "
1677 "possible error return)."
1678 msgstr ""
1679
1680 #. type: Plain text
1681 #: build/C/man3/pthread_attr_setschedparam.3:107
1682 msgid ""
1683 "The B<pthread_attr_setschedparam>()  and B<pthread_attr_getschedparam>()  "
1684 "functions are thread-safe."
1685 msgstr ""
1686
1687 #. type: Plain text
1688 #: build/C/man3/pthread_attr_setschedparam.3:113
1689 msgid ""
1690 "See B<pthread_attr_setschedpolicy>(3)  for a list of the thread scheduling "
1691 "policies supported on Linux."
1692 msgstr ""
1693
1694 #. type: Plain text
1695 #: build/C/man3/pthread_attr_setschedparam.3:127
1696 msgid ""
1697 "B<sched_get_priority_min>(2), B<pthread_attr_init>(3), "
1698 "B<pthread_attr_setinheritsched>(3), B<pthread_attr_setschedpolicy>(3), "
1699 "B<pthread_create>(3), B<pthread_setschedparam>(3), "
1700 "B<pthread_setschedprio>(3), B<pthreads>(7), B<sched>(7)"
1701 msgstr ""
1702
1703 #. type: TH
1704 #: build/C/man3/pthread_attr_setschedpolicy.3:26
1705 #, no-wrap
1706 msgid "PTHREAD_ATTR_SETSCHEDPOLICY"
1707 msgstr ""
1708
1709 #. type: Plain text
1710 #: build/C/man3/pthread_attr_setschedpolicy.3:30
1711 msgid ""
1712 "pthread_attr_setschedpolicy, pthread_attr_getschedpolicy - set/get "
1713 "scheduling policy attribute in thread attributes object"
1714 msgstr ""
1715
1716 #. type: Plain text
1717 #: build/C/man3/pthread_attr_setschedpolicy.3:38
1718 #, no-wrap
1719 msgid ""
1720 "B<int pthread_attr_setschedpolicy(pthread_attr_t *>I<attr>B<, int "
1721 ">I<policy>B<);>\n"
1722 "B<int pthread_attr_getschedpolicy(const pthread_attr_t *>I<attr>B<, int "
1723 ">I<*policy>B<);>\n"
1724 msgstr ""
1725
1726 #. type: Plain text
1727 #: build/C/man3/pthread_attr_setschedpolicy.3:52
1728 msgid ""
1729 "The B<pthread_attr_setschedpolicy>()  function sets the scheduling policy "
1730 "attribute of the thread attributes object referred to by I<attr> to the "
1731 "value specified in I<policy>.  This attribute determines the scheduling "
1732 "policy of a thread created using the thread attributes object I<attr>."
1733 msgstr ""
1734
1735 #.  FIXME . pthread_setschedparam() places no restriction on the policy,
1736 #.  but pthread_attr_setschedpolicy() restricts policy to RR/FIFO/OTHER
1737 #.  http://sourceware.org/bugzilla/show_bug.cgi?id=7013
1738 #. type: Plain text
1739 #: build/C/man3/pthread_attr_setschedpolicy.3:65
1740 msgid ""
1741 "The supported values for I<policy> are B<SCHED_FIFO>, B<SCHED_RR>, and "
1742 "B<SCHED_OTHER>, with the semantics described in B<sched>(7)."
1743 msgstr ""
1744
1745 #. type: Plain text
1746 #: build/C/man3/pthread_attr_setschedpolicy.3:72
1747 msgid ""
1748 "The B<pthread_attr_getschedpolicy>()  returns the scheduling policy "
1749 "attribute of the thread attributes object I<attr> in the buffer pointed to "
1750 "by I<policy>."
1751 msgstr ""
1752
1753 #. type: Plain text
1754 #: build/C/man3/pthread_attr_setschedpolicy.3:83
1755 msgid ""
1756 "In order for the policy setting made by B<pthread_attr_setschedpolicy>()  to "
1757 "have effect when calling B<pthread_create>(3), the caller must use "
1758 "B<pthread_attr_setinheritsched>(3)  to set the inherit-scheduler attribute "
1759 "of the attributes object I<attr> to B<PTHREAD_EXPLICIT_SCHED>."
1760 msgstr ""
1761
1762 #. type: Plain text
1763 #: build/C/man3/pthread_attr_setschedpolicy.3:89
1764 msgid "B<pthread_attr_setschedpolicy>()  can fail with the following error:"
1765 msgstr ""
1766
1767 #. type: Plain text
1768 #: build/C/man3/pthread_attr_setschedpolicy.3:93
1769 msgid "Invalid value in I<policy>."
1770 msgstr ""
1771
1772 #.  .SH VERSIONS
1773 #.  Available since glibc 2.0.
1774 #. type: Plain text
1775 #: build/C/man3/pthread_attr_setschedpolicy.3:100
1776 msgid ""
1777 "POSIX.1-2001 also documents an optional B<ENOTSUP> error (\"attempt was made "
1778 "to set the attribute to an unsupported value\") for "
1779 "B<pthread_attr_setschedpolicy>()."
1780 msgstr ""
1781
1782 #. type: Plain text
1783 #: build/C/man3/pthread_attr_setschedpolicy.3:107
1784 msgid ""
1785 "The B<pthread_attr_setschedpolicy>()  and B<pthread_attr_getschedpolicy>()  "
1786 "functions are thread-safe."
1787 msgstr ""
1788
1789 #. type: Plain text
1790 #: build/C/man3/pthread_attr_setschedpolicy.3:122
1791 msgid ""
1792 "B<pthread_attr_init>(3), B<pthread_attr_setinheritsched>(3), "
1793 "B<pthread_attr_setschedparam>(3), B<pthread_create>(3), "
1794 "B<pthread_setschedparam>(3), B<pthread_setschedprio>(3), B<pthreads>(7), "
1795 "B<sched>(7)"
1796 msgstr ""
1797
1798 #. type: TH
1799 #: build/C/man3/pthread_attr_setscope.3:26
1800 #, no-wrap
1801 msgid "PTHREAD_ATTR_SETSCOPE"
1802 msgstr ""
1803
1804 #. type: Plain text
1805 #: build/C/man3/pthread_attr_setscope.3:30
1806 msgid ""
1807 "pthread_attr_setscope, pthread_attr_getscope - set/get contention scope "
1808 "attribute in thread attributes object"
1809 msgstr ""
1810
1811 #. type: Plain text
1812 #: build/C/man3/pthread_attr_setscope.3:38
1813 #, no-wrap
1814 msgid ""
1815 "B<int pthread_attr_setscope(pthread_attr_t *>I<attr>B<, int >I<scope>B<);>\n"
1816 "B<int pthread_attr_getscope(const pthread_attr_t *>I<attr>B<, int "
1817 "*>I<scope>B<);>\n"
1818 msgstr ""
1819
1820 #. type: Plain text
1821 #: build/C/man3/pthread_attr_setscope.3:53
1822 msgid ""
1823 "The B<pthread_attr_setscope>()  function sets the contention scope attribute "
1824 "of the thread attributes object referred to by I<attr> to the value "
1825 "specified in I<scope>.  The contention scope attribute defines the set of "
1826 "threads against which a thread competes for resources such as the CPU.  "
1827 "POSIX.1-2001 specifies two possible values for I<scope>:"
1828 msgstr ""
1829
1830 #. type: TP
1831 #: build/C/man3/pthread_attr_setscope.3:53
1832 #, no-wrap
1833 msgid "B<PTHREAD_SCOPE_SYSTEM>"
1834 msgstr ""
1835
1836 #. type: Plain text
1837 #: build/C/man3/pthread_attr_setscope.3:61
1838 msgid ""
1839 "The thread competes for resources with all other threads in all processes on "
1840 "the system that are in the same scheduling allocation domain (a group of one "
1841 "or more processors).  B<PTHREAD_SCOPE_SYSTEM> threads are scheduled relative "
1842 "to one another according to their scheduling policy and priority."
1843 msgstr ""
1844
1845 #. type: TP
1846 #: build/C/man3/pthread_attr_setscope.3:61
1847 #, no-wrap
1848 msgid "B<PTHREAD_SCOPE_PROCESS>"
1849 msgstr ""
1850
1851 #. type: Plain text
1852 #: build/C/man3/pthread_attr_setscope.3:76
1853 msgid ""
1854 "The thread competes for resources with all other threads in the same process "
1855 "that were also created with the B<PTHREAD_SCOPE_PROCESS> contention scope.  "
1856 "B<PTHREAD_SCOPE_PROCESS> threads are scheduled relative to other threads in "
1857 "the process according to their scheduling policy and priority.  POSIX.1-2001 "
1858 "leaves it unspecified how these threads contend with other threads in other "
1859 "process on the system or with other threads in the same process that were "
1860 "created with the B<PTHREAD_SCOPE_SYSTEM> contention scope."
1861 msgstr ""
1862
1863 #. type: Plain text
1864 #: build/C/man3/pthread_attr_setscope.3:83
1865 msgid ""
1866 "POSIX.1-2001 requires that an implementation support at least one of these "
1867 "contention scopes.  Linux supports B<PTHREAD_SCOPE_SYSTEM>, but not "
1868 "B<PTHREAD_SCOPE_PROCESS>."
1869 msgstr ""
1870
1871 #. type: Plain text
1872 #: build/C/man3/pthread_attr_setscope.3:95
1873 msgid ""
1874 "On systems that support multiple contention scopes, then, in order for the "
1875 "parameter setting made by B<pthread_attr_setscope>()  to have effect when "
1876 "calling B<pthread_create>(3), the caller must use "
1877 "B<pthread_attr_setinheritsched>(3)  to set the inherit-scheduler attribute "
1878 "of the attributes object I<attr> to B<PTHREAD_EXPLICIT_SCHED>."
1879 msgstr ""
1880
1881 #. type: Plain text
1882 #: build/C/man3/pthread_attr_setscope.3:103
1883 msgid ""
1884 "The B<pthread_attr_getscope>()  function returns the contention scope "
1885 "attribute of the thread attributes object referred to by I<attr> in the "
1886 "buffer pointed to by I<scope>."
1887 msgstr ""
1888
1889 #. type: Plain text
1890 #: build/C/man3/pthread_attr_setscope.3:109
1891 msgid "B<pthread_attr_setscope>()  can fail with the following errors:"
1892 msgstr ""
1893
1894 #. type: Plain text
1895 #: build/C/man3/pthread_attr_setscope.3:113
1896 msgid "An invalid value was specified in I<scope>."
1897 msgstr ""
1898
1899 #. type: TP
1900 #: build/C/man3/pthread_attr_setscope.3:113
1901 #, no-wrap
1902 msgid "B<ENOTSUP>"
1903 msgstr ""
1904
1905 #. type: Plain text
1906 #: build/C/man3/pthread_attr_setscope.3:119
1907 msgid ""
1908 "I<scope> specified the value B<PTHREAD_SCOPE_PROCESS>, which is not "
1909 "supported on Linux."
1910 msgstr ""
1911
1912 #. type: Plain text
1913 #: build/C/man3/pthread_attr_setscope.3:126
1914 msgid ""
1915 "The B<pthread_attr_setscope>()  and B<pthread_attr_getscope>()  functions "
1916 "are thread-safe."
1917 msgstr ""
1918
1919 #. type: Plain text
1920 #: build/C/man3/pthread_attr_setscope.3:136
1921 msgid ""
1922 "The B<PTHREAD_SCOPE_SYSTEM> contention scope typically indicates that a "
1923 "user-space thread is bound directly to a single kernel-scheduling entity.  "
1924 "This is the case on Linux for the obsolete LinuxThreads implementation and "
1925 "the modern NPTL implementation, which are both 1:1 threading "
1926 "implementations."
1927 msgstr ""
1928
1929 #. type: Plain text
1930 #: build/C/man3/pthread_attr_setscope.3:139
1931 msgid ""
1932 "POSIX.1-2001 specifies that the default contention scope is "
1933 "implementation-defined."
1934 msgstr ""
1935
1936 #. type: Plain text
1937 #: build/C/man3/pthread_attr_setscope.3:148
1938 msgid ""
1939 "B<pthread_attr_init>(3), B<pthread_attr_setaffinity_np>(3), "
1940 "B<pthread_attr_setinheritsched>(3), B<pthread_attr_setschedparam>(3), "
1941 "B<pthread_attr_setschedpolicy>(3), B<pthread_create>(3), B<pthreads>(7)"
1942 msgstr ""
1943
1944 #. type: TH
1945 #: build/C/man3/pthread_attr_setstack.3:26
1946 #, no-wrap
1947 msgid "PTHREAD_ATTR_SETSTACK"
1948 msgstr ""
1949
1950 #. type: Plain text
1951 #: build/C/man3/pthread_attr_setstack.3:30
1952 msgid ""
1953 "pthread_attr_setstack, pthread_attr_getstack - set/get stack attributes in "
1954 "thread attributes object"
1955 msgstr ""
1956
1957 #. type: Plain text
1958 #: build/C/man3/pthread_attr_setstack.3:38
1959 #, no-wrap
1960 msgid ""
1961 "B<int pthread_attr_setstack(pthread_attr_t *>I<attr>B<,>\n"
1962 "B<                          void *>I<stackaddr>B<, size_t "
1963 ">I<stacksize>B<);>\n"
1964 "B<int pthread_attr_getstack(const pthread_attr_t *>I<attr>B<,>\n"
1965 "B<                          void **>I<stackaddr>B<, size_t "
1966 "*>I<stacksize>B<);>\n"
1967 msgstr ""
1968
1969 #. type: Plain text
1970 #: build/C/man3/pthread_attr_setstack.3:45 build/C/man3/pthread_cleanup_push_defer_np.3:44 build/C/man3/pthread_kill.3:41 build/C/man3/pthread_rwlockattr_setkind_np.3:44 build/C/man3/pthread_sigmask.3:42 build/C/man3/pthread_sigqueue.3:42
1971 msgid "Feature Test Macro Requirements for glibc (see B<feature_test_macros>(7)):"
1972 msgstr ""
1973
1974 #. type: Plain text
1975 #: build/C/man3/pthread_attr_setstack.3:50
1976 msgid "B<pthread_attr_getstack>(), B<pthread_attr_setstack>():"
1977 msgstr ""
1978
1979 #. type: Plain text
1980 #: build/C/man3/pthread_attr_setstack.3:52
1981 msgid "_POSIX_C_SOURCE\\ E<gt>=\\ 200112L || _XOPEN_SOURCE\\ E<gt>=\\ 600"
1982 msgstr ""
1983
1984 #. type: Plain text
1985 #: build/C/man3/pthread_attr_setstack.3:68
1986 msgid ""
1987 "The B<pthread_attr_setstack>()  function sets the stack address and stack "
1988 "size attributes of the thread attributes object referred to by I<attr> to "
1989 "the values specified in I<stackaddr> and I<stacksize>, respectively.  These "
1990 "attributes specify the location and size of the stack that should be used by "
1991 "a thread that is created using the thread attributes object I<attr>."
1992 msgstr ""
1993
1994 #. type: Plain text
1995 #: build/C/man3/pthread_attr_setstack.3:74
1996 msgid ""
1997 "I<stackaddr> should point to the lowest addressable byte of a buffer of "
1998 "I<stacksize> bytes that was allocated by the caller.  The pages of the "
1999 "allocated buffer should be both readable and writable."
2000 msgstr ""
2001
2002 #. type: Plain text
2003 #: build/C/man3/pthread_attr_setstack.3:85
2004 msgid ""
2005 "The B<pthread_attr_getstack>()  function returns the stack address and stack "
2006 "size attributes of the thread attributes object referred to by I<attr> in "
2007 "the buffers pointed to by I<stackaddr> and I<stacksize>, respectively."
2008 msgstr ""
2009
2010 #. type: Plain text
2011 #: build/C/man3/pthread_attr_setstack.3:91
2012 msgid "B<pthread_attr_setstack>()  can fail with the following error:"
2013 msgstr ""
2014
2015 #. type: Plain text
2016 #: build/C/man3/pthread_attr_setstack.3:102
2017 msgid ""
2018 "I<stacksize> is less than B<PTHREAD_STACK_MIN> (16384) bytes.  On some "
2019 "systems, this error may also occur if I<stackaddr> or I<stackaddr\\ +\\ "
2020 "stacksize> is not suitably aligned."
2021 msgstr ""
2022
2023 #. type: Plain text
2024 #: build/C/man3/pthread_attr_setstack.3:110
2025 msgid ""
2026 "POSIX.1-2001 also documents an B<EACCES> error if the stack area described "
2027 "by I<stackaddr> and I<stacksize> is not both readable and writable by the "
2028 "caller."
2029 msgstr ""
2030
2031 #. type: Plain text
2032 #: build/C/man3/pthread_attr_setstack.3:112
2033 msgid "These functions are provided by glibc since version 2.2."
2034 msgstr ""
2035
2036 #. type: Plain text
2037 #: build/C/man3/pthread_attr_setstack.3:119
2038 msgid ""
2039 "The B<pthread_attr_setstack>()  and B<pthread_attr_getstack>()  functions "
2040 "are thread-safe."
2041 msgstr ""
2042
2043 #. type: Plain text
2044 #: build/C/man3/pthread_attr_setstack.3:129
2045 msgid ""
2046 "These functions are provided for applications that must ensure that a "
2047 "thread's stack is placed in a particular location.  For most applications, "
2048 "this is not necessary, and the use of these functions should be avoided.  "
2049 "(Use B<pthread_attr_setstacksize>(3)  if an application simply requires a "
2050 "stack size other than the default.)"
2051 msgstr ""
2052
2053 #. type: Plain text
2054 #: build/C/man3/pthread_attr_setstack.3:140
2055 msgid ""
2056 "When an application employs B<pthread_attr_setstack>(), it takes over the "
2057 "responsibility of allocating the stack.  Any guard size value that was set "
2058 "using B<pthread_attr_setguardsize>(3)  is ignored.  If deemed necessary, it "
2059 "is the application's responsibility to allocate a guard area (one or more "
2060 "pages protected against reading and writing)  to handle the possibility of "
2061 "stack overflow."
2062 msgstr ""
2063
2064 #. type: Plain text
2065 #: build/C/man3/pthread_attr_setstack.3:151
2066 msgid ""
2067 "The address specified in I<stackaddr> should be suitably aligned: for full "
2068 "portability, align it on a page boundary (I<sysconf(_SC_PAGESIZE)>).  "
2069 "B<posix_memalign>(3)  may be useful for allocation.  Probably, I<stacksize> "
2070 "should also be a multiple of the system page size."
2071 msgstr ""
2072
2073 #. type: Plain text
2074 #: build/C/man3/pthread_attr_setstack.3:159
2075 msgid ""
2076 "If I<attr> is used to create multiple threads, then the caller must change "
2077 "the stack address attribute between calls to B<pthread_create>(3); "
2078 "otherwise, the threads will attempt to use the same memory area for their "
2079 "stacks, and chaos will ensue."
2080 msgstr ""
2081
2082 #. type: Plain text
2083 #: build/C/man3/pthread_attr_setstack.3:173
2084 msgid ""
2085 "B<mmap>(2), B<mprotect>(2), B<posix_memalign>(3), B<pthread_attr_init>(3), "
2086 "B<pthread_attr_setguardsize>(3), B<pthread_attr_setstackaddr>(3), "
2087 "B<pthread_attr_setstacksize>(3), B<pthread_create>(3), B<pthreads>(7)"
2088 msgstr ""
2089
2090 #. type: TH
2091 #: build/C/man3/pthread_attr_setstackaddr.3:26
2092 #, no-wrap
2093 msgid "PTHREAD_ATTR_SETSTACKADDR"
2094 msgstr ""
2095
2096 #. type: Plain text
2097 #: build/C/man3/pthread_attr_setstackaddr.3:30
2098 msgid ""
2099 "pthread_attr_setstackaddr, pthread_attr_getstackaddr - set/get stack address "
2100 "attribute in thread attributes object"
2101 msgstr ""
2102
2103 #. type: Plain text
2104 #: build/C/man3/pthread_attr_setstackaddr.3:38
2105 #, no-wrap
2106 msgid ""
2107 "B<int pthread_attr_setstackaddr(pthread_attr_t *>I<attr>B<, void "
2108 "*>I<stackaddr>B<);>\n"
2109 "B<int pthread_attr_getstackaddr(const pthread_attr_t *>I<attr>B<, void "
2110 "**>I<stackaddr>B<);>\n"
2111 msgstr ""
2112
2113 #. type: Plain text
2114 #: build/C/man3/pthread_attr_setstackaddr.3:49
2115 msgid ""
2116 "These functions are obsolete: B<do not use them.> Use "
2117 "B<pthread_attr_setstack>(3)  and B<pthread_attr_getstack>(3)  instead."
2118 msgstr ""
2119
2120 #. type: Plain text
2121 #: build/C/man3/pthread_attr_setstackaddr.3:60
2122 msgid ""
2123 "The B<pthread_attr_setstackaddr>()  function sets the stack address "
2124 "attribute of the thread attributes object referred to by I<attr> to the "
2125 "value specified in I<stackaddr>.  This attribute specifies the location of "
2126 "the stack that should be used by a thread that is created using the thread "
2127 "attributes object I<attr>."
2128 msgstr ""
2129
2130 #. type: Plain text
2131 #: build/C/man3/pthread_attr_setstackaddr.3:66
2132 msgid ""
2133 "I<stackaddr> should point to a buffer of at least B<PTHREAD_STACK_MIN> bytes "
2134 "that was allocated by the caller.  The pages of the allocated buffer should "
2135 "be both readable and writable."
2136 msgstr ""
2137
2138 #. type: Plain text
2139 #: build/C/man3/pthread_attr_setstackaddr.3:74
2140 msgid ""
2141 "The B<pthread_attr_getstackaddr>()  function returns the stack address "
2142 "attribute of the thread attributes object referred to by I<attr> in the "
2143 "buffer pointed to by I<stackaddr>."
2144 msgstr ""
2145
2146 #. type: Plain text
2147 #: build/C/man3/pthread_attr_setstackaddr.3:81
2148 msgid ""
2149 "No errors are defined (but applications should nevertheless handle a "
2150 "possible error return)."
2151 msgstr ""
2152
2153 #. type: Plain text
2154 #: build/C/man3/pthread_attr_setstackaddr.3:90
2155 msgid ""
2156 "The B<pthread_attr_setstackaddr>()  and B<pthread_attr_getstackaddr>()  "
2157 "functions are thread-safe."
2158 msgstr ""
2159
2160 #. type: Plain text
2161 #: build/C/man3/pthread_attr_setstackaddr.3:93
2162 msgid ""
2163 "POSIX.1-2001 specifies these functions but marks them as obsolete.  "
2164 "POSIX.1-2008 removes the specification of these functions."
2165 msgstr ""
2166
2167 #. type: Plain text
2168 #: build/C/man3/pthread_attr_setstackaddr.3:117
2169 msgid ""
2170 "I<Do not use these functions!> They cannot be portably used, since they "
2171 "provide no way of specifying the direction of growth or the range of the "
2172 "stack.  For example, on architectures with a stack that grows downward, "
2173 "I<stackaddr> specifies the next address past the I<highest> address of the "
2174 "allocated stack area.  However, on architectures with a stack that grows "
2175 "upward, I<stackaddr> specifies the I<lowest> address in the allocated stack "
2176 "area.  By contrast, the I<stackaddr> used by B<pthread_attr_setstack>(3)  "
2177 "and B<pthread_attr_getstack>(3), is always a pointer to the lowest address "
2178 "in the allocated stack area (and the I<stacksize> argument specifies the "
2179 "range of the stack)."
2180 msgstr ""
2181
2182 #. type: Plain text
2183 #: build/C/man3/pthread_attr_setstackaddr.3:122
2184 msgid ""
2185 "B<pthread_attr_init>(3), B<pthread_attr_setstack>(3), "
2186 "B<pthread_attr_setstacksize>(3), B<pthread_create>(3), B<pthreads>(7)"
2187 msgstr ""
2188
2189 #. type: TH
2190 #: build/C/man3/pthread_attr_setstacksize.3:26
2191 #, no-wrap
2192 msgid "PTHREAD_ATTR_SETSTACKSIZE"
2193 msgstr ""
2194
2195 #. type: Plain text
2196 #: build/C/man3/pthread_attr_setstacksize.3:30
2197 msgid ""
2198 "pthread_attr_setstacksize, pthread_attr_getstacksize - set/get stack size "
2199 "attribute in thread attributes object"
2200 msgstr ""
2201
2202 #. type: Plain text
2203 #: build/C/man3/pthread_attr_setstacksize.3:38
2204 #, no-wrap
2205 msgid ""
2206 "B<int pthread_attr_setstacksize(pthread_attr_t *>I<attr>B<, size_t "
2207 ">I<stacksize>B<);>\n"
2208 "B<int pthread_attr_getstacksize(const pthread_attr_t *>I<attr>B<, size_t "
2209 "*>I<stacksize>B<);>\n"
2210 msgstr ""
2211
2212 #. type: Plain text
2213 #: build/C/man3/pthread_attr_setstacksize.3:49
2214 msgid ""
2215 "The B<pthread_attr_setstacksize>()  function sets the stack size attribute "
2216 "of the thread attributes object referred to by I<attr> to the value "
2217 "specified in I<stacksize>."
2218 msgstr ""
2219
2220 #. type: Plain text
2221 #: build/C/man3/pthread_attr_setstacksize.3:53
2222 msgid ""
2223 "The stack size attribute determines the minimum size (in bytes) that will be "
2224 "allocated for threads created using the thread attributes object I<attr>."
2225 msgstr ""
2226
2227 #. type: Plain text
2228 #: build/C/man3/pthread_attr_setstacksize.3:61
2229 msgid ""
2230 "The B<pthread_attr_getstacksize>()  function returns the stack size "
2231 "attribute of the thread attributes object referred to by I<attr> in the "
2232 "buffer pointed to by I<stacksize>."
2233 msgstr ""
2234
2235 #. type: Plain text
2236 #: build/C/man3/pthread_attr_setstacksize.3:67
2237 msgid "B<pthread_attr_setstacksize>()  can fail with the following error:"
2238 msgstr ""
2239
2240 #. type: Plain text
2241 #: build/C/man3/pthread_attr_setstacksize.3:72
2242 msgid "The stack size is less than B<PTHREAD_STACK_MIN> (16384) bytes."
2243 msgstr ""
2244
2245 #.  e.g., MacOS
2246 #. type: Plain text
2247 #: build/C/man3/pthread_attr_setstacksize.3:81
2248 msgid ""
2249 "On some systems, B<pthread_attr_setstacksize>()  can fail with the error "
2250 "B<EINVAL> if I<stacksize> is not a multiple of the system page size."
2251 msgstr ""
2252
2253 #. type: Plain text
2254 #: build/C/man3/pthread_attr_setstacksize.3:90
2255 msgid ""
2256 "The B<pthread_attr_setstacksize>()  and B<pthread_attr_getstacksize>()  "
2257 "functions are thread-safe."
2258 msgstr ""
2259
2260 #. type: Plain text
2261 #: build/C/man3/pthread_attr_setstacksize.3:95
2262 msgid ""
2263 "For details on the default stack size of new threads, see "
2264 "B<pthread_create>(3)."
2265 msgstr ""
2266
2267 #. type: Plain text
2268 #: build/C/man3/pthread_attr_setstacksize.3:98
2269 msgid ""
2270 "A thread's stack size is fixed at the time of thread creation.  Only the "
2271 "main thread can dynamically grow its stack."
2272 msgstr ""
2273
2274 #. type: Plain text
2275 #: build/C/man3/pthread_attr_setstacksize.3:103
2276 msgid ""
2277 "The B<pthread_attr_setstack>(3)  function allows an application to set both "
2278 "the size and location of a caller-allocated stack that is to be used by a "
2279 "thread."
2280 msgstr ""
2281
2282 #. type: Plain text
2283 #: build/C/man3/pthread_attr_setstacksize.3:115
2284 msgid ""
2285 "As at glibc 2.8, if the specified I<stacksize> is not a multiple of "
2286 "B<STACK_ALIGN> (16 bytes on most architectures), it may be rounded "
2287 "I<downward>, in violation of POSIX.1-2001, which says that the allocated "
2288 "stack will be at least I<stacksize> bytes."
2289 msgstr ""
2290
2291 #. type: Plain text
2292 #: build/C/man3/pthread_attr_setstacksize.3:118 build/C/man3/pthread_join.3:127
2293 msgid "See B<pthread_create>(3)."
2294 msgstr ""
2295
2296 #. type: Plain text
2297 #: build/C/man3/pthread_attr_setstacksize.3:124
2298 msgid ""
2299 "B<getrlimit>(2), B<pthread_attr_init>(3), B<pthread_attr_setguardsize>(3), "
2300 "B<pthread_attr_setstack>(3), B<pthread_create>(3), B<pthreads>(7)"
2301 msgstr ""
2302
2303 #. type: TH
2304 #: build/C/man3/pthread_cancel.3:26
2305 #, no-wrap
2306 msgid "PTHREAD_CANCEL"
2307 msgstr ""
2308
2309 #. type: TH
2310 #: build/C/man3/pthread_cancel.3:26
2311 #, no-wrap
2312 msgid "2008-11-17"
2313 msgstr ""
2314
2315 #. type: Plain text
2316 #: build/C/man3/pthread_cancel.3:29
2317 msgid "pthread_cancel - send a cancellation request to a thread"
2318 msgstr ""
2319
2320 #. type: Plain text
2321 #: build/C/man3/pthread_cancel.3:34
2322 #, no-wrap
2323 msgid "B<int pthread_cancel(pthread_t >I<thread>B<);>\n"
2324 msgstr ""
2325
2326 #. type: Plain text
2327 #: build/C/man3/pthread_cancel.3:49
2328 msgid ""
2329 "The B<pthread_cancel>()  function sends a cancellation request to the thread "
2330 "I<thread>.  Whether and when the target thread reacts to the cancellation "
2331 "request depends on two attributes that are under the control of that thread: "
2332 "its cancelability I<state> and I<type>."
2333 msgstr ""
2334
2335 #. type: Plain text
2336 #: build/C/man3/pthread_cancel.3:61
2337 msgid ""
2338 "A thread's cancelability state, determined by B<pthread_setcancelstate>(3), "
2339 "can be I<enabled> (the default for new threads) or I<disabled>.  If a thread "
2340 "has disabled cancellation, then a cancellation request remains queued until "
2341 "the thread enables cancellation.  If a thread has enabled cancellation, then "
2342 "its cancelability type determines when cancellation occurs."
2343 msgstr ""
2344
2345 #. type: Plain text
2346 #: build/C/man3/pthread_cancel.3:77
2347 msgid ""
2348 "A thread's cancellation type, determined by B<pthread_setcanceltype>(3), may "
2349 "be either I<asynchronous> or I<deferred> (the default for new threads).  "
2350 "Asynchronous cancelability means that the thread can be canceled at any time "
2351 "(usually immediately, but the system does not guarantee this).  Deferred "
2352 "cancelability means that cancellation will be delayed until the thread next "
2353 "calls a function that is a I<cancellation point>.  A list of functions that "
2354 "are or may be cancellation points is provided in B<pthreads>(7)."
2355 msgstr ""
2356
2357 #. type: Plain text
2358 #: build/C/man3/pthread_cancel.3:81
2359 msgid ""
2360 "When a cancellation requested is acted on, the following steps occur for "
2361 "I<thread> (in this order):"
2362 msgstr ""
2363
2364 #. type: IP
2365 #: build/C/man3/pthread_cancel.3:81 build/C/man3/pthread_cleanup_push.3:69
2366 #, no-wrap
2367 msgid "1."
2368 msgstr ""
2369
2370 #. type: Plain text
2371 #: build/C/man3/pthread_cancel.3:86
2372 msgid ""
2373 "Cancellation clean-up handlers are popped (in the reverse of the order in "
2374 "which they were pushed) and called.  (See B<pthread_cleanup_push>(3).)"
2375 msgstr ""
2376
2377 #. type: IP
2378 #: build/C/man3/pthread_cancel.3:86 build/C/man3/pthread_cleanup_push.3:73
2379 #, no-wrap
2380 msgid "2."
2381 msgstr ""
2382
2383 #. type: Plain text
2384 #: build/C/man3/pthread_cancel.3:91
2385 msgid ""
2386 "Thread-specific data destructors are called, in an unspecified order.  (See "
2387 "B<pthread_key_create>(3).)"
2388 msgstr ""
2389
2390 #. type: IP
2391 #: build/C/man3/pthread_cancel.3:91 build/C/man3/pthread_cleanup_push.3:83
2392 #, no-wrap
2393 msgid "3."
2394 msgstr ""
2395
2396 #. type: Plain text
2397 #: build/C/man3/pthread_cancel.3:95
2398 msgid "The thread is terminated.  (See B<pthread_exit>(3).)"
2399 msgstr ""
2400
2401 #. type: Plain text
2402 #: build/C/man3/pthread_cancel.3:103
2403 msgid ""
2404 "The above steps happen asynchronously with respect to the "
2405 "B<pthread_cancel>()  call; the return status of B<pthread_cancel>()  merely "
2406 "informs the caller whether the cancellation request was successfully queued."
2407 msgstr ""
2408
2409 #. type: Plain text
2410 #: build/C/man3/pthread_cancel.3:112
2411 msgid ""
2412 "After a canceled thread has terminated, a join with that thread using "
2413 "B<pthread_join>(3)  obtains B<PTHREAD_CANCELED> as the thread's exit "
2414 "status.  (Joining with a thread is the only way to know that cancellation "
2415 "has completed.)"
2416 msgstr ""
2417
2418 #. type: Plain text
2419 #: build/C/man3/pthread_cancel.3:117
2420 msgid ""
2421 "On success, B<pthread_cancel>()  returns 0; on error, it returns a nonzero "
2422 "error number."
2423 msgstr ""
2424
2425 #. type: TP
2426 #: build/C/man3/pthread_cancel.3:118 build/C/man3/pthread_detach.3:59 build/C/man3/pthread_getcpuclockid.3:58 build/C/man3/pthread_join.3:93 build/C/man3/pthread_setaffinity_np.3:114 build/C/man3/pthread_setschedparam.3:114 build/C/man3/pthread_setschedprio.3:70 build/C/man3/pthread_sigqueue.3:86
2427 #, no-wrap
2428 msgid "B<ESRCH>"
2429 msgstr ""
2430
2431 #. type: Plain text
2432 #: build/C/man3/pthread_cancel.3:125 build/C/man3/pthread_detach.3:64 build/C/man3/pthread_getcpuclockid.3:63 build/C/man3/pthread_join.3:98 build/C/man3/pthread_setaffinity_np.3:119 build/C/man3/pthread_setschedparam.3:119 build/C/man3/pthread_setschedprio.3:75
2433 msgid "No thread with the ID I<thread> could be found."
2434 msgstr ""
2435
2436 #. type: Plain text
2437 #: build/C/man3/pthread_cancel.3:135
2438 msgid ""
2439 "On Linux, cancellation is implemented using signals.  Under the NPTL "
2440 "threading implementation, the first real-time signal (i.e., signal 32) is "
2441 "used for this purpose.  On LinuxThreads, the second real-time signal is "
2442 "used, if real-time signals are available, otherwise B<SIGUSR2> is used."
2443 msgstr ""
2444
2445 #. type: Plain text
2446 #: build/C/man3/pthread_cancel.3:141
2447 msgid ""
2448 "The program below creates a thread and then cancels it.  The main thread "
2449 "joins with the canceled thread to check that its exit status was "
2450 "B<PTHREAD_CANCELED>.  The following shell session shows what happens when we "
2451 "run the program:"
2452 msgstr ""
2453
2454 #. type: Plain text
2455 #: build/C/man3/pthread_cancel.3:149
2456 #, no-wrap
2457 msgid ""
2458 "$ ./a.out\n"
2459 "thread_func(): started; cancellation disabled\n"
2460 "main(): sending cancellation request\n"
2461 "thread_func(): about to enable cancellation\n"
2462 "main(): thread was canceled\n"
2463 msgstr ""
2464
2465 #. type: Plain text
2466 #: build/C/man3/pthread_cancel.3:159
2467 #, no-wrap
2468 msgid ""
2469 "#include E<lt>pthread.hE<gt>\n"
2470 "#include E<lt>stdio.hE<gt>\n"
2471 "#include E<lt>errno.hE<gt>\n"
2472 "#include E<lt>stdlib.hE<gt>\n"
2473 "#include E<lt>unistd.hE<gt>\n"
2474 msgstr ""
2475
2476 #. type: Plain text
2477 #: build/C/man3/pthread_cancel.3:167
2478 #, no-wrap
2479 msgid ""
2480 "static void *\n"
2481 "thread_func(void *ignored_argument)\n"
2482 "{\n"
2483 "    int s;\n"
2484 msgstr ""
2485
2486 #. type: Plain text
2487 #: build/C/man3/pthread_cancel.3:170
2488 #, no-wrap
2489 msgid ""
2490 "    /* Disable cancellation for a while, so that we don\\(aqt\n"
2491 "       immediately react to a cancellation request */\n"
2492 msgstr ""
2493
2494 #. type: Plain text
2495 #: build/C/man3/pthread_cancel.3:174
2496 #, no-wrap
2497 msgid ""
2498 "    s = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);\n"
2499 "    if (s != 0)\n"
2500 "        handle_error_en(s, \"pthread_setcancelstate\");\n"
2501 msgstr ""
2502
2503 #. type: Plain text
2504 #: build/C/man3/pthread_cancel.3:178
2505 #, no-wrap
2506 msgid ""
2507 "    printf(\"thread_func(): started; cancellation disabled\\en\");\n"
2508 "    sleep(5);\n"
2509 "    printf(\"thread_func(): about to enable cancellation\\en\");\n"
2510 msgstr ""
2511
2512 #. type: Plain text
2513 #: build/C/man3/pthread_cancel.3:182
2514 #, no-wrap
2515 msgid ""
2516 "    s = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);\n"
2517 "    if (s != 0)\n"
2518 "        handle_error_en(s, \"pthread_setcancelstate\");\n"
2519 msgstr ""
2520
2521 #. type: Plain text
2522 #: build/C/man3/pthread_cancel.3:184
2523 #, no-wrap
2524 msgid "    /* sleep() is a cancellation point */\n"
2525 msgstr ""
2526
2527 #. type: Plain text
2528 #: build/C/man3/pthread_cancel.3:186
2529 #, no-wrap
2530 msgid "    sleep(1000);        /* Should get canceled while we sleep */\n"
2531 msgstr ""
2532
2533 #. type: Plain text
2534 #: build/C/man3/pthread_cancel.3:188
2535 #, no-wrap
2536 msgid "    /* Should never get here */\n"
2537 msgstr ""
2538
2539 #. type: Plain text
2540 #: build/C/man3/pthread_cancel.3:192
2541 #, no-wrap
2542 msgid ""
2543 "    printf(\"thread_func(): not canceled!\\en\");\n"
2544 "    return NULL;\n"
2545 "}\n"
2546 msgstr ""
2547
2548 #. type: Plain text
2549 #: build/C/man3/pthread_cancel.3:199
2550 #, no-wrap
2551 msgid ""
2552 "int\n"
2553 "main(void)\n"
2554 "{\n"
2555 "    pthread_t thr;\n"
2556 "    void *res;\n"
2557 "    int s;\n"
2558 msgstr ""
2559
2560 #. type: Plain text
2561 #: build/C/man3/pthread_cancel.3:201
2562 #, no-wrap
2563 msgid "    /* Start a thread and then send it a cancellation request */\n"
2564 msgstr ""
2565
2566 #. type: Plain text
2567 #: build/C/man3/pthread_cancel.3:205
2568 #, no-wrap
2569 msgid ""
2570 "    s = pthread_create(&thr, NULL, &thread_func, NULL);\n"
2571 "    if (s != 0)\n"
2572 "        handle_error_en(s, \"pthread_create\");\n"
2573 msgstr ""
2574
2575 #. type: Plain text
2576 #: build/C/man3/pthread_cancel.3:207
2577 #, no-wrap
2578 msgid "    sleep(2);           /* Give thread a chance to get started */\n"
2579 msgstr ""
2580
2581 #. type: Plain text
2582 #: build/C/man3/pthread_cancel.3:212
2583 #, no-wrap
2584 msgid ""
2585 "    printf(\"main(): sending cancellation request\\en\");\n"
2586 "    s = pthread_cancel(thr);\n"
2587 "    if (s != 0)\n"
2588 "        handle_error_en(s, \"pthread_cancel\");\n"
2589 msgstr ""
2590
2591 #. type: Plain text
2592 #: build/C/man3/pthread_cancel.3:214
2593 #, no-wrap
2594 msgid "    /* Join with thread to see what its exit status was */\n"
2595 msgstr ""
2596
2597 #. type: Plain text
2598 #: build/C/man3/pthread_cancel.3:218 build/C/man3/pthread_cleanup_push.3:307
2599 #, no-wrap
2600 msgid ""
2601 "    s = pthread_join(thr, &res);\n"
2602 "    if (s != 0)\n"
2603 "        handle_error_en(s, \"pthread_join\");\n"
2604 msgstr ""
2605
2606 #. type: Plain text
2607 #: build/C/man3/pthread_cancel.3:225
2608 #, no-wrap
2609 msgid ""
2610 "    if (res == PTHREAD_CANCELED)\n"
2611 "        printf(\"main(): thread was canceled\\en\");\n"
2612 "    else\n"
2613 "        printf(\"main(): thread wasn\\(aqt canceled (shouldn\\(aqt "
2614 "happen!)\\en\");\n"
2615 "    exit(EXIT_SUCCESS);\n"
2616 "}\n"
2617 msgstr ""
2618
2619 #. type: Plain text
2620 #: build/C/man3/pthread_cancel.3:237
2621 msgid ""
2622 "B<pthread_cleanup_push>(3), B<pthread_create>(3), B<pthread_exit>(3), "
2623 "B<pthread_join>(3), B<pthread_key_create>(3), B<pthread_setcancelstate>(3), "
2624 "B<pthread_setcanceltype>(3), B<pthread_testcancel>(3), B<pthreads>(7)"
2625 msgstr ""
2626
2627 #. type: TH
2628 #: build/C/man3/pthread_cleanup_push.3:26
2629 #, no-wrap
2630 msgid "PTHREAD_CLEANUP_PUSH"
2631 msgstr ""
2632
2633 #. type: TH
2634 #: build/C/man3/pthread_cleanup_push.3:26
2635 #, no-wrap
2636 msgid "2008-11-24"
2637 msgstr ""
2638
2639 #. type: Plain text
2640 #: build/C/man3/pthread_cleanup_push.3:30
2641 msgid ""
2642 "pthread_cleanup_push, pthread_cleanup_pop - push and pop thread cancellation "
2643 "clean-up handlers"
2644 msgstr ""
2645
2646 #. type: Plain text
2647 #: build/C/man3/pthread_cleanup_push.3:37
2648 #, no-wrap
2649 msgid ""
2650 "B<void pthread_cleanup_push(void (*>I<routine>B<)(void *),>\n"
2651 "B<                          void *>I<arg>B<);>\n"
2652 "B<void pthread_cleanup_pop(int >I<execute>B<);>\n"
2653 msgstr ""
2654
2655 #. type: Plain text
2656 #: build/C/man3/pthread_cleanup_push.3:48
2657 msgid ""
2658 "These functions manipulate the calling thread's stack of thread-cancellation "
2659 "clean-up handlers.  A clean-up handler is a function that is automatically "
2660 "executed when a thread is canceled (or in various other circumstances "
2661 "described below); it might, for example, unlock a mutex so that it becomes "
2662 "available to other threads in the process."
2663 msgstr ""
2664
2665 #. type: Plain text
2666 #: build/C/man3/pthread_cleanup_push.3:59
2667 msgid ""
2668 "The B<pthread_cleanup_push>()  function pushes I<routine> onto the top of "
2669 "the stack of clean-up handlers.  When I<routine> is later invoked, it will "
2670 "be given I<arg> as its argument."
2671 msgstr ""
2672
2673 #. type: Plain text
2674 #: build/C/man3/pthread_cleanup_push.3:66
2675 msgid ""
2676 "The B<pthread_cleanup_pop>()  function removes the routine at the top of the "
2677 "stack of clean-up handlers, and optionally executes it if I<execute> is "
2678 "nonzero."
2679 msgstr ""
2680
2681 #. type: Plain text
2682 #: build/C/man3/pthread_cleanup_push.3:69
2683 msgid ""
2684 "A cancellation clean-up handler is popped from the stack and executed in the "
2685 "following circumstances:"
2686 msgstr ""
2687
2688 #. type: Plain text
2689 #: build/C/man3/pthread_cleanup_push.3:73
2690 msgid ""
2691 "When a thread is canceled, all of the stacked clean-up handlers are popped "
2692 "and executed in the reverse of the order in which they were pushed onto the "
2693 "stack."
2694 msgstr ""
2695
2696 #. type: Plain text
2697 #: build/C/man3/pthread_cleanup_push.3:83
2698 msgid ""
2699 "When a thread terminates by calling B<pthread_exit>(3), all clean-up "
2700 "handlers are executed as described in the preceding point.  (Clean-up "
2701 "handlers are I<not> called if the thread terminates by performing a "
2702 "I<return> from the thread start function.)"
2703 msgstr ""
2704
2705 #. type: Plain text
2706 #: build/C/man3/pthread_cleanup_push.3:89
2707 msgid ""
2708 "When a thread calls B<pthread_cleanup_pop>()  with a nonzero I<execute> "
2709 "argument, the top-most clean-up handler is popped and executed."
2710 msgstr ""
2711
2712 #. type: Plain text
2713 #: build/C/man3/pthread_cleanup_push.3:101
2714 msgid ""
2715 "POSIX.1 permits B<pthread_cleanup_push>()  and B<pthread_cleanup_pop>()  to "
2716 "be implemented as macros that expand to text containing \\(aqB<{>\\(aq and "
2717 "\\(aqB<}>\\(aq, respectively.  For this reason, the caller must ensure that "
2718 "calls to these functions are paired within the same function, and at the "
2719 "same lexical nesting level.  (In other words, a clean-up handler is "
2720 "established only during the execution of a specified section of code.)"
2721 msgstr ""
2722
2723 #. type: Plain text
2724 #: build/C/man3/pthread_cleanup_push.3:121
2725 msgid ""
2726 "Calling B<longjmp>(3)  (B<siglongjmp>(3))  produces undefined results if any "
2727 "call has been made to B<pthread_cleanup_push>()  or B<pthread_cleanup_pop>()  "
2728 "without the matching call of the pair since the jump buffer was filled by "
2729 "B<setjmp>(3)  (B<sigsetjmp>(3)).  Likewise, calling B<longjmp>(3)  "
2730 "(B<siglongjmp>(3))  from inside a clean-up handler produces undefined "
2731 "results unless the jump buffer was also filled by B<setjmp>(3)  "
2732 "(B<sigsetjmp>(3))  inside the handler."
2733 msgstr ""
2734
2735 #. type: Plain text
2736 #: build/C/man3/pthread_cleanup_push.3:123
2737 msgid "These functions do not return a value."
2738 msgstr ""
2739
2740 #.  SH VERSIONS
2741 #.  Available since glibc 2.0
2742 #. type: Plain text
2743 #: build/C/man3/pthread_cleanup_push.3:127
2744 msgid "There are no errors."
2745 msgstr ""
2746
2747 #. type: Plain text
2748 #: build/C/man3/pthread_cleanup_push.3:140
2749 msgid ""
2750 "On Linux, the B<pthread_cleanup_push>()  and B<pthread_cleanup_pop>()  "
2751 "functions I<are> implemented as macros that expand to text containing "
2752 "\\(aqB<{>\\(aq and \\(aqB<}>\\(aq, respectively.  This means that variables "
2753 "declared within the scope of paired calls to these functions will be visible "
2754 "within only that scope."
2755 msgstr ""
2756
2757 #.  The text was actually added in the 2004 TC2
2758 #. type: Plain text
2759 #: build/C/man3/pthread_cleanup_push.3:155
2760 msgid ""
2761 "POSIX.1 says that the effect of using I<return>, I<break>, I<continue>, or "
2762 "I<goto> to prematurely leave a block bracketed B<pthread_cleanup_push>()  "
2763 "and B<pthread_cleanup_pop>()  is undefined.  Portable applications should "
2764 "avoid doing this."
2765 msgstr ""
2766
2767 #. type: Plain text
2768 #: build/C/man3/pthread_cleanup_push.3:170
2769 msgid ""
2770 "The program below provides a simple example of the use of the functions "
2771 "described in this page.  The program creates a thread that executes a loop "
2772 "bracketed by B<pthread_cleanup_push>()  and B<pthread_cleanup_pop>().  This "
2773 "loop increments a global variable, I<cnt>, once each second.  Depending on "
2774 "what command-line arguments are supplied, the main thread sends the other "
2775 "thread a cancellation request, or sets a global variable that causes the "
2776 "other thread to exit its loop and terminate normally (by doing a I<return>)."
2777 msgstr ""
2778
2779 #. type: Plain text
2780 #: build/C/man3/pthread_cleanup_push.3:173
2781 msgid ""
2782 "In the following shell session, the main thread sends a cancellation request "
2783 "to the other thread:"
2784 msgstr ""
2785
2786 #. type: Plain text
2787 #: build/C/man3/pthread_cleanup_push.3:183
2788 #, no-wrap
2789 msgid ""
2790 "$ B<./a.out>\n"
2791 "New thread started\n"
2792 "cnt = 0\n"
2793 "cnt = 1\n"
2794 "Canceling thread\n"
2795 "Called clean-up handler\n"
2796 "Thread was canceled; cnt = 0\n"
2797 msgstr ""
2798
2799 #. type: Plain text
2800 #: build/C/man3/pthread_cleanup_push.3:191
2801 msgid ""
2802 "From the above, we see that the thread was canceled, and that the "
2803 "cancellation clean-up handler was called and it reset the value of the "
2804 "global variable I<cnt> to 0."
2805 msgstr ""
2806
2807 #. type: Plain text
2808 #: build/C/man3/pthread_cleanup_push.3:194
2809 msgid ""
2810 "In the next run, the main program sets a global variable that causes other "
2811 "thread to terminate normally:"
2812 msgstr ""
2813
2814 #. type: Plain text
2815 #: build/C/man3/pthread_cleanup_push.3:202
2816 #, no-wrap
2817 msgid ""
2818 "$ B<./a.out x>\n"
2819 "New thread started\n"
2820 "cnt = 0\n"
2821 "cnt = 1\n"
2822 "Thread terminated normally; cnt = 2\n"
2823 msgstr ""
2824
2825 #. type: Plain text
2826 #: build/C/man3/pthread_cleanup_push.3:210
2827 msgid ""
2828 "From the above, we see that the clean-up handler was not executed (because "
2829 "I<cleanup_pop_arg> was 0), and therefore the value of I<cnt> was not reset."
2830 msgstr ""
2831
2832 #. type: Plain text
2833 #: build/C/man3/pthread_cleanup_push.3:215
2834 msgid ""
2835 "In the next run, the main program sets a global variable that causes the "
2836 "other thread to terminate normally, and supplies a nonzero value for "
2837 "I<cleanup_pop_arg>:"
2838 msgstr ""
2839
2840 #. type: Plain text
2841 #: build/C/man3/pthread_cleanup_push.3:224
2842 #, no-wrap
2843 msgid ""
2844 "$ B<./a.out x 1>\n"
2845 "New thread started\n"
2846 "cnt = 0\n"
2847 "cnt = 1\n"
2848 "Called clean-up handler\n"
2849 "Thread terminated normally; cnt = 0\n"
2850 msgstr ""
2851
2852 #. type: Plain text
2853 #: build/C/man3/pthread_cleanup_push.3:231
2854 msgid ""
2855 "In the above, we see that although the thread was not canceled, the clean-up "
2856 "handler was executed, because the argument given to B<pthread_cleanup_pop>()  "
2857 "was nonzero."
2858 msgstr ""
2859
2860 #. type: Plain text
2861 #: build/C/man3/pthread_cleanup_push.3:240
2862 #, no-wrap
2863 msgid ""
2864 "#include E<lt>pthread.hE<gt>\n"
2865 "#include E<lt>sys/types.hE<gt>\n"
2866 "#include E<lt>stdio.hE<gt>\n"
2867 "#include E<lt>stdlib.hE<gt>\n"
2868 "#include E<lt>unistd.hE<gt>\n"
2869 "#include E<lt>errno.hE<gt>\n"
2870 msgstr ""
2871
2872 #. type: Plain text
2873 #: build/C/man3/pthread_cleanup_push.3:247
2874 #, no-wrap
2875 msgid ""
2876 "static int done = 0;\n"
2877 "static int cleanup_pop_arg = 0;\n"
2878 "static int cnt = 0;\n"
2879 msgstr ""
2880
2881 #. type: Plain text
2882 #: build/C/man3/pthread_cleanup_push.3:254
2883 #, no-wrap
2884 msgid ""
2885 "static void\n"
2886 "cleanup_handler(void *arg)\n"
2887 "{\n"
2888 "    printf(\"Called clean-up handler\\en\");\n"
2889 "    cnt = 0;\n"
2890 "}\n"
2891 msgstr ""
2892
2893 #. type: Plain text
2894 #: build/C/man3/pthread_cleanup_push.3:259
2895 #, no-wrap
2896 msgid ""
2897 "static void *\n"
2898 "thread_start(void *arg)\n"
2899 "{\n"
2900 "    time_t start, curr;\n"
2901 msgstr ""
2902
2903 #. type: Plain text
2904 #: build/C/man3/pthread_cleanup_push.3:261
2905 #, no-wrap
2906 msgid "    printf(\"New thread started\\en\");\n"
2907 msgstr ""
2908
2909 #. type: Plain text
2910 #: build/C/man3/pthread_cleanup_push.3:263
2911 #, no-wrap
2912 msgid "    pthread_cleanup_push(cleanup_handler, NULL);\n"
2913 msgstr ""
2914
2915 #. type: Plain text
2916 #: build/C/man3/pthread_cleanup_push.3:265
2917 #, no-wrap
2918 msgid "    curr = start = time(NULL);\n"
2919 msgstr ""
2920
2921 #. type: Plain text
2922 #: build/C/man3/pthread_cleanup_push.3:274
2923 #, no-wrap
2924 msgid ""
2925 "    while (!done) {\n"
2926 "        pthread_testcancel();           /* A cancellation point */\n"
2927 "        if (curr E<lt> time(NULL)) {\n"
2928 "            curr = time(NULL);\n"
2929 "            printf(\"cnt = %d\\en\", cnt);  /* A cancellation point */\n"
2930 "            cnt++;\n"
2931 "        }\n"
2932 "    }\n"
2933 msgstr ""
2934
2935 #. type: Plain text
2936 #: build/C/man3/pthread_cleanup_push.3:278
2937 #, no-wrap
2938 msgid ""
2939 "    pthread_cleanup_pop(cleanup_pop_arg);\n"
2940 "    return NULL;\n"
2941 "}\n"
2942 msgstr ""
2943
2944 #. type: Plain text
2945 #: build/C/man3/pthread_cleanup_push.3:285
2946 #, no-wrap
2947 msgid ""
2948 "int\n"
2949 "main(int argc, char *argv[])\n"
2950 "{\n"
2951 "    pthread_t thr;\n"
2952 "    int s;\n"
2953 "    void *res;\n"
2954 msgstr ""
2955
2956 #. type: Plain text
2957 #: build/C/man3/pthread_cleanup_push.3:289
2958 #, no-wrap
2959 msgid ""
2960 "    s = pthread_create(&thr, NULL, thread_start, NULL);\n"
2961 "    if (s != 0)\n"
2962 "        handle_error_en(s, \"pthread_create\");\n"
2963 msgstr ""
2964
2965 #. type: Plain text
2966 #: build/C/man3/pthread_cleanup_push.3:291
2967 #, no-wrap
2968 msgid "    sleep(2);           /* Allow new thread to run a while */\n"
2969 msgstr ""
2970
2971 #. type: Plain text
2972 #: build/C/man3/pthread_cleanup_push.3:296
2973 #, no-wrap
2974 msgid ""
2975 "    if (argc E<gt> 1) {\n"
2976 "        if (argc E<gt> 2)\n"
2977 "            cleanup_pop_arg = atoi(argv[2]);\n"
2978 "        done = 1;\n"
2979 msgstr ""
2980
2981 #. type: Plain text
2982 #: build/C/man3/pthread_cleanup_push.3:303
2983 #, no-wrap
2984 msgid ""
2985 "    } else {\n"
2986 "        printf(\"Canceling thread\\en\");\n"
2987 "        s = pthread_cancel(thr);\n"
2988 "        if (s != 0)\n"
2989 "            handle_error_en(s, \"pthread_cancel\");\n"
2990 "    }\n"
2991 msgstr ""
2992
2993 #. type: Plain text
2994 #: build/C/man3/pthread_cleanup_push.3:314
2995 #, no-wrap
2996 msgid ""
2997 "    if (res == PTHREAD_CANCELED)\n"
2998 "        printf(\"Thread was canceled; cnt = %d\\en\", cnt);\n"
2999 "    else\n"
3000 "        printf(\"Thread terminated normally; cnt = %d\\en\", cnt);\n"
3001 "    exit(EXIT_SUCCESS);\n"
3002 "}\n"
3003 msgstr ""
3004
3005 #. type: Plain text
3006 #: build/C/man3/pthread_cleanup_push.3:320
3007 msgid ""
3008 "B<pthread_cancel>(3), B<pthread_cleanup_push_defer_np>(3), "
3009 "B<pthread_setcancelstate>(3), B<pthread_testcancel>(3), B<pthreads>(7)"
3010 msgstr ""
3011
3012 #. type: TH
3013 #: build/C/man3/pthread_cleanup_push_defer_np.3:26
3014 #, no-wrap
3015 msgid "PTHREAD_CLEANUP_PUSH_DEFER_NP"
3016 msgstr ""
3017
3018 #. type: Plain text
3019 #: build/C/man3/pthread_cleanup_push_defer_np.3:30
3020 msgid ""
3021 "pthread_cleanup_push_defer_np, pthread_cleanup_pop_restore_np - push and pop "
3022 "thread cancellation clean-up handlers while saving cancelability type"
3023 msgstr ""
3024
3025 #. type: Plain text
3026 #: build/C/man3/pthread_cleanup_push_defer_np.3:37
3027 #, no-wrap
3028 msgid ""
3029 "B<void pthread_cleanup_push_defer_np(void (*>I<routine>B<)(void *),>\n"
3030 "B<                                   void *>I<arg>B<);>\n"
3031 "B<void pthread_cleanup_pop_restore_np(int >I<execute>B<);>\n"
3032 msgstr ""
3033
3034 #. type: Plain text
3035 #: build/C/man3/pthread_cleanup_push_defer_np.3:40 build/C/man3/pthread_create.3:38 build/C/man3/pthread_detach.3:37 build/C/man3/pthread_join.3:37 build/C/man3/pthread_kill.3:37 build/C/man3/pthread_setname_np.3:39 build/C/man3/pthread_sigmask.3:38 build/C/man3/pthread_sigqueue.3:38 build/C/man3/pthread_tryjoin_np.3:42 build/C/man3/pthread_yield.3:37
3036 msgid "Compile and link with I<-pthread>."
3037 msgstr ""
3038
3039 #. type: Plain text
3040 #: build/C/man3/pthread_cleanup_push_defer_np.3:49
3041 msgid "B<pthread_cleanup_push_defer_np>(), B<pthread_cleanup_pop_defer_np>():"
3042 msgstr ""
3043
3044 #. type: Plain text
3045 #: build/C/man3/pthread_cleanup_push_defer_np.3:51
3046 msgid "_GNU_SOURCE"
3047 msgstr ""
3048
3049 #. type: Plain text
3050 #: build/C/man3/pthread_cleanup_push_defer_np.3:59
3051 msgid ""
3052 "These functions are the same as B<pthread_cleanup_push>(3)  and "
3053 "B<pthread_cleanup_pop>(3), except for the differences noted on this page."
3054 msgstr ""
3055
3056 #. type: Plain text
3057 #: build/C/man3/pthread_cleanup_push_defer_np.3:72
3058 msgid ""
3059 "Like B<pthread_cleanup_push>(3), B<pthread_cleanup_push_defer_np>()  pushes "
3060 "I<routine> onto the thread's stack of cancellation clean-up handlers.  In "
3061 "addition, it also saves the thread's current cancelability type, and sets "
3062 "the cancelability type to \"deferred\" (see B<pthread_setcanceltype>(3)); "
3063 "this ensures that cancellation clean-up will occur even if the thread's "
3064 "cancelability type was \"asynchronous\" before the call."
3065 msgstr ""
3066
3067 #. type: Plain text
3068 #: build/C/man3/pthread_cleanup_push_defer_np.3:81
3069 msgid ""
3070 "Like B<pthread_cleanup_pop>(3), B<pthread_cleanup_pop_restore_np>()  pops "
3071 "the top-most clean-up handler from the thread's stack of cancellation "
3072 "clean-up handlers.  In addition, it restores the thread's cancelability type "
3073 "to its value at the time of the matching B<pthread_cleanup_push_defer_np>()."
3074 msgstr ""
3075
3076 #. type: Plain text
3077 #: build/C/man3/pthread_cleanup_push_defer_np.3:87
3078 msgid ""
3079 "The caller must ensure that calls to these functions are paired within the "
3080 "same function, and at the same lexical nesting level.  Other restrictions "
3081 "apply, as described in B<pthread_cleanup_push>(3)."
3082 msgstr ""
3083
3084 #. type: Plain text
3085 #: build/C/man3/pthread_cleanup_push_defer_np.3:89
3086 msgid "This sequence of calls:"
3087 msgstr ""
3088
3089 #. type: Plain text
3090 #: build/C/man3/pthread_cleanup_push_defer_np.3:94
3091 #, no-wrap
3092 msgid ""
3093 "pthread_cleanup_push_defer_np(routine, arg);\n"
3094 "pthread_cleanup_pop_restore_np(execute);\n"
3095 msgstr ""
3096
3097 #. type: Plain text
3098 #: build/C/man3/pthread_cleanup_push_defer_np.3:98
3099 msgid "is equivalent to (but shorter and more efficient than):"
3100 msgstr ""
3101
3102 #. type: Plain text
3103 #: build/C/man3/pthread_cleanup_push_defer_np.3:104
3104 #, no-wrap
3105 msgid "int oldtype;\n"
3106 msgstr ""
3107
3108 #. type: Plain text
3109 #: build/C/man3/pthread_cleanup_push_defer_np.3:110
3110 #, no-wrap
3111 msgid ""
3112 "pthread_cleanup_push(routine, arg);\n"
3113 "pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldtype);\n"
3114 "\\&...\n"
3115 "pthread_setcanceltype(oldtype, NULL);\n"
3116 "pthread_cleanup_pop(execute);\n"
3117 msgstr ""
3118
3119 #. type: Plain text
3120 #: build/C/man3/pthread_cleanup_push_defer_np.3:122
3121 msgid ""
3122 "B<pthread_cancel>(3), B<pthread_cleanup_push>(3), "
3123 "B<pthread_setcancelstate>(3), B<pthread_testcancel>(3), B<pthreads>(7)"
3124 msgstr ""
3125
3126 #. type: TH
3127 #: build/C/man3/pthread_create.3:26
3128 #, no-wrap
3129 msgid "PTHREAD_CREATE"
3130 msgstr ""
3131
3132 #. type: Plain text
3133 #: build/C/man3/pthread_create.3:29
3134 msgid "pthread_create - create a new thread"
3135 msgstr ""
3136
3137 #. type: Plain text
3138 #: build/C/man3/pthread_create.3:35
3139 #, no-wrap
3140 msgid ""
3141 "B<int pthread_create(pthread_t *>I<thread>B<, const pthread_attr_t "
3142 "*>I<attr>B<,>\n"
3143 "B<                   void *(*>I<start_routine>B<) (void *), void "
3144 "*>I<arg>B<);>\n"
3145 msgstr ""
3146
3147 #. type: Plain text
3148 #: build/C/man3/pthread_create.3:47
3149 msgid ""
3150 "The B<pthread_create>()  function starts a new thread in the calling "
3151 "process.  The new thread starts execution by invoking I<start_routine>(); "
3152 "I<arg> is passed as the sole argument of I<start_routine>()."
3153 msgstr ""
3154
3155 #. type: Plain text
3156 #: build/C/man3/pthread_create.3:49
3157 msgid "The new thread terminates in one of the following ways:"
3158 msgstr ""
3159
3160 #. type: IP
3161 #: build/C/man3/pthread_create.3:49 build/C/man3/pthread_create.3:55 build/C/man3/pthread_create.3:63 build/C/man3/pthread_create.3:66 build/C/man3/pthread_getattr_np.3:52 build/C/man3/pthread_getattr_np.3:55 build/C/man3/pthread_getattr_np.3:58
3162 #, no-wrap
3163 msgid "*"
3164 msgstr ""
3165
3166 #. type: Plain text
3167 #: build/C/man3/pthread_create.3:55
3168 msgid ""
3169 "It calls B<pthread_exit>(3), specifying an exit status value that is "
3170 "available to another thread in the same process that calls "
3171 "B<pthread_join>(3)."
3172 msgstr ""
3173
3174 #. type: Plain text
3175 #: build/C/man3/pthread_create.3:63
3176 msgid ""
3177 "It returns from I<start_routine>().  This is equivalent to calling "
3178 "B<pthread_exit>(3)  with the value supplied in the I<return> statement."
3179 msgstr ""
3180
3181 #. type: Plain text
3182 #: build/C/man3/pthread_create.3:66
3183 msgid "It is canceled (see B<pthread_cancel>(3))."
3184 msgstr ""
3185
3186 #. type: Plain text
3187 #: build/C/man3/pthread_create.3:72
3188 msgid ""
3189 "Any of the threads in the process calls B<exit>(3), or the main thread "
3190 "performs a return from I<main>().  This causes the termination of all "
3191 "threads in the process."
3192 msgstr ""
3193
3194 #. type: Plain text
3195 #: build/C/man3/pthread_create.3:86
3196 msgid ""
3197 "The I<attr> argument points to a I<pthread_attr_t> structure whose contents "
3198 "are used at thread creation time to determine attributes for the new thread; "
3199 "this structure is initialized using B<pthread_attr_init>(3)  and related "
3200 "functions.  If I<attr> is NULL, then the thread is created with default "
3201 "attributes."
3202 msgstr ""
3203
3204 #. type: Plain text
3205 #: build/C/man3/pthread_create.3:93
3206 msgid ""
3207 "Before returning, a successful call to B<pthread_create>()  stores the ID of "
3208 "the new thread in the buffer pointed to by I<thread>; this identifier is "
3209 "used to refer to the thread in subsequent calls to other pthreads functions."
3210 msgstr ""
3211
3212 #. type: Plain text
3213 #: build/C/man3/pthread_create.3:101
3214 msgid ""
3215 "The new thread inherits a copy of the creating thread's signal mask "
3216 "(B<pthread_sigmask>(3)).  The set of pending signals for the new thread is "
3217 "empty (B<sigpending>(2)).  The new thread does not inherit the creating "
3218 "thread's alternate signal stack (B<sigaltstack>(2))."
3219 msgstr ""
3220
3221 #. type: Plain text
3222 #: build/C/man3/pthread_create.3:104
3223 msgid ""
3224 "The new thread inherits the calling thread's floating-point environment "
3225 "(B<fenv>(3))."
3226 msgstr ""
3227
3228 #.  CLOCK_THREAD_CPUTIME_ID in clock_gettime(2)
3229 #. type: Plain text
3230 #: build/C/man3/pthread_create.3:109
3231 msgid ""
3232 "The initial value of the new thread's CPU-time clock is 0 (see "
3233 "B<pthread_getcpuclockid>(3))."
3234 msgstr ""
3235
3236 #. type: SS
3237 #: build/C/man3/pthread_create.3:109
3238 #, no-wrap
3239 msgid "Linux-specific details"
3240 msgstr ""
3241
3242 #. type: Plain text
3243 #: build/C/man3/pthread_create.3:115
3244 msgid ""
3245 "The new thread inherits copies of the calling thread's capability sets (see "
3246 "B<capabilities>(7))  and CPU affinity mask (see B<sched_setaffinity>(2))."
3247 msgstr ""
3248
3249 #. type: Plain text
3250 #: build/C/man3/pthread_create.3:122
3251 msgid ""
3252 "On success, B<pthread_create>()  returns 0; on error, it returns an error "
3253 "number, and the contents of I<*thread> are undefined."
3254 msgstr ""
3255
3256 #. type: TP
3257 #: build/C/man3/pthread_create.3:123 build/C/man3/pthread_create.3:126 build/C/man3/pthread_sigqueue.3:72
3258 #, no-wrap
3259 msgid "B<EAGAIN>"
3260 msgstr ""
3261
3262 #. type: Plain text
3263 #: build/C/man3/pthread_create.3:126
3264 msgid "Insufficient resources to create another thread."
3265 msgstr ""
3266
3267 #.  NOTE! The following should match the description in fork(2)
3268 #. type: Plain text
3269 #: build/C/man3/pthread_create.3:144
3270 msgid ""
3271 "A system-imposed limit on the number of threads was encountered.  There are "
3272 "a number of limits that may trigger this error: the B<RLIMIT_NPROC> soft "
3273 "resource limit (set via B<setrlimit>(2)), which limits the number of "
3274 "processes and threads for a real user ID, was reached; the kernel's "
3275 "system-wide limit on the number of processes and threads, "
3276 "I</proc/sys/kernel/threads-max>, was reached (see B<proc>(5)); or the "
3277 "maximum number of PIDs, I</proc/sys/kernel/pid_max>, was reached (see "
3278 "B<proc>(5))."
3279 msgstr ""
3280
3281 #. type: Plain text
3282 #: build/C/man3/pthread_create.3:148
3283 msgid "Invalid settings in I<attr>."
3284 msgstr ""
3285
3286 #. type: TP
3287 #: build/C/man3/pthread_create.3:148 build/C/man3/pthread_setschedparam.3:129 build/C/man3/pthread_setschedprio.3:66
3288 #, no-wrap
3289 msgid "B<EPERM>"
3290 msgstr ""
3291
3292 #. type: Plain text
3293 #: build/C/man3/pthread_create.3:153
3294 msgid ""
3295 "No permission to set the scheduling policy and parameters specified in "
3296 "I<attr>."
3297 msgstr ""
3298
3299 #. type: Plain text
3300 #: build/C/man3/pthread_create.3:167
3301 msgid ""
3302 "See B<pthread_self>(3)  for further information on the thread ID returned in "
3303 "I<*thread> by B<pthread_create>().  Unless real-time scheduling policies are "
3304 "being employed, after a call to B<pthread_create>(), it is indeterminate "
3305 "which thread\\(emthe caller or the new thread\\(emwill next execute."
3306 msgstr ""
3307
3308 #. type: Plain text
3309 #: build/C/man3/pthread_create.3:187
3310 msgid ""
3311 "A thread may either be I<joinable> or I<detached>.  If a thread is joinable, "
3312 "then another thread can call B<pthread_join>(3)  to wait for the thread to "
3313 "terminate and fetch its exit status.  Only when a terminated joinable thread "
3314 "has been joined are the last of its resources released back to the system.  "
3315 "When a detached thread terminates, its resources are automatically released "
3316 "back to the system: it is not possible to join with the thread in order to "
3317 "obtain its exit status.  Making a thread detached is useful for some types "
3318 "of daemon threads whose exit status the application does not need to care "
3319 "about.  By default, a new thread is created in a joinable state, unless "
3320 "I<attr> was set to create the thread in a detached state (using "
3321 "B<pthread_attr_setdetachstate>(3))."
3322 msgstr ""
3323
3324 #.  FIXME . Perhaps some of the following detail should be in
3325 #.  a future pthread_attr_setstacksize(3) page.
3326 #. type: Plain text
3327 #: build/C/man3/pthread_create.3:203
3328 msgid ""
3329 "On Linux/x86-32, the default stack size for a new thread is 2 megabytes.  "
3330 "Under the NPTL threading implementation, if the B<RLIMIT_STACK> soft "
3331 "resource limit I<at the time the program started> has any value other than "
3332 "\"unlimited\", then it determines the default stack size of new threads.  "
3333 "Using B<pthread_attr_setstacksize>(3), the stack size attribute can be "
3334 "explicitly set in the I<attr> argument used to create a thread, in order to "
3335 "obtain a stack size other than the default."
3336 msgstr ""
3337
3338 #. type: Plain text
3339 #: build/C/man3/pthread_create.3:209
3340 msgid ""
3341 "In the obsolete LinuxThreads implementation, each of the threads in a "
3342 "process has a different process ID.  This is in violation of the POSIX "
3343 "threads specification, and is the source of many other nonconformances to "
3344 "the standard; see B<pthreads>(7)."
3345 msgstr ""
3346
3347 #. type: Plain text
3348 #: build/C/man3/pthread_create.3:213
3349 msgid ""
3350 "The program below demonstrates the use of B<pthread_create>(), as well as a "
3351 "number of other functions in the pthreads API."
3352 msgstr ""
3353
3354 #. type: Plain text
3355 #: build/C/man3/pthread_create.3:218
3356 msgid ""
3357 "In the following run, on a system providing the NPTL threading "
3358 "implementation, the stack size defaults to the value given by the \"stack "
3359 "size\" resource limit:"
3360 msgstr ""
3361
3362 #. type: Plain text
3363 #: build/C/man3/pthread_create.3:230
3364 #, no-wrap
3365 msgid ""
3366 "$B< ulimit -s>\n"
3367 "8192            # The stack size limit is 8 MB (0x800000 bytes)\n"
3368 "$B< ./a.out hola salut servus>\n"
3369 "Thread 1: top of stack near 0xb7dd03b8; argv_string=hola\n"
3370 "Thread 2: top of stack near 0xb75cf3b8; argv_string=salut\n"
3371 "Thread 3: top of stack near 0xb6dce3b8; argv_string=servus\n"
3372 "Joined with thread 1; returned value was HOLA\n"
3373 "Joined with thread 2; returned value was SALUT\n"
3374 "Joined with thread 3; returned value was SERVUS\n"
3375 msgstr ""
3376
3377 #. type: Plain text
3378 #: build/C/man3/pthread_create.3:236
3379 msgid ""
3380 "In the next run, the program explicitly sets a stack size of 1MB (using "
3381 "B<pthread_attr_setstacksize>(3))  for the created threads:"
3382 msgstr ""
3383
3384 #. type: Plain text
3385 #: build/C/man3/pthread_create.3:246
3386 #, no-wrap
3387 msgid ""
3388 "$B< ./a.out -s 0x100000 hola salut servus>\n"
3389 "Thread 1: top of stack near 0xb7d723b8; argv_string=hola\n"
3390 "Thread 2: top of stack near 0xb7c713b8; argv_string=salut\n"
3391 "Thread 3: top of stack near 0xb7b703b8; argv_string=servus\n"
3392 "Joined with thread 1; returned value was HOLA\n"
3393 "Joined with thread 2; returned value was SALUT\n"
3394 "Joined with thread 3; returned value was SERVUS\n"
3395 msgstr ""
3396
3397 #. type: Plain text
3398 #: build/C/man3/pthread_create.3:258
3399 #, no-wrap
3400 msgid ""
3401 "#include E<lt>pthread.hE<gt>\n"
3402 "#include E<lt>string.hE<gt>\n"
3403 "#include E<lt>stdio.hE<gt>\n"
3404 "#include E<lt>stdlib.hE<gt>\n"
3405 "#include E<lt>unistd.hE<gt>\n"
3406 "#include E<lt>errno.hE<gt>\n"
3407 "#include E<lt>ctype.hE<gt>\n"
3408 msgstr ""
3409
3410 #. type: Plain text
3411 #: build/C/man3/pthread_create.3:264 build/C/man3/pthread_getcpuclockid.3:116
3412 #, no-wrap
3413 msgid ""
3414 "#define handle_error(msg) \\e\n"
3415 "        do { perror(msg); exit(EXIT_FAILURE); } while (0)\n"
3416 msgstr ""
3417
3418 #. type: Plain text
3419 #: build/C/man3/pthread_create.3:270
3420 #, no-wrap
3421 msgid ""
3422 "struct thread_info {    /* Used as argument to thread_start() */\n"
3423 "    pthread_t thread_id;        /* ID returned by pthread_create() */\n"
3424 "    int       thread_num;       /* Application-defined thread # */\n"
3425 "    char     *argv_string;      /* From command-line argument */\n"
3426 "};\n"
3427 msgstr ""
3428
3429 #. type: Plain text
3430 #: build/C/man3/pthread_create.3:273
3431 #, no-wrap
3432 msgid ""
3433 "/* Thread start function: display address near top of our stack,\n"
3434 "   and return upper-cased copy of argv_string */\n"
3435 msgstr ""
3436
3437 #. type: Plain text
3438 #: build/C/man3/pthread_create.3:279
3439 #, no-wrap
3440 msgid ""
3441 "static void *\n"
3442 "thread_start(void *arg)\n"
3443 "{\n"
3444 "    struct thread_info *tinfo = arg;\n"
3445 "    char *uargv, *p;\n"
3446 msgstr ""
3447
3448 #. type: Plain text
3449 #: build/C/man3/pthread_create.3:282
3450 #, no-wrap
3451 msgid ""
3452 "    printf(\"Thread %d: top of stack near %p; argv_string=%s\\en\",\n"
3453 "            tinfo-E<gt>thread_num, &p, tinfo-E<gt>argv_string);\n"
3454 msgstr ""
3455
3456 #. type: Plain text
3457 #: build/C/man3/pthread_create.3:286
3458 #, no-wrap
3459 msgid ""
3460 "    uargv = strdup(tinfo-E<gt>argv_string);\n"
3461 "    if (uargv == NULL)\n"
3462 "        handle_error(\"strdup\");\n"
3463 msgstr ""
3464
3465 #. type: Plain text
3466 #: build/C/man3/pthread_create.3:289
3467 #, no-wrap
3468 msgid ""
3469 "    for (p = uargv; *p != \\(aq\\e0\\(aq; p++)\n"
3470 "        *p = toupper(*p);\n"
3471 msgstr ""
3472
3473 #. type: Plain text
3474 #: build/C/man3/pthread_create.3:292
3475 #, no-wrap
3476 msgid ""
3477 "    return uargv;\n"
3478 "}\n"
3479 msgstr ""
3480
3481 #. type: Plain text
3482 #: build/C/man3/pthread_create.3:301
3483 #, no-wrap
3484 msgid ""
3485 "int\n"
3486 "main(int argc, char *argv[])\n"
3487 "{\n"
3488 "    int s, tnum, opt, num_threads;\n"
3489 "    struct thread_info *tinfo;\n"
3490 "    pthread_attr_t attr;\n"
3491 "    int stack_size;\n"
3492 "    void *res;\n"
3493 msgstr ""
3494
3495 #. type: Plain text
3496 #: build/C/man3/pthread_create.3:303
3497 #, no-wrap
3498 msgid "    /* The \"-s\" option specifies a stack size for our threads */\n"
3499 msgstr ""
3500
3501 #. type: Plain text
3502 #: build/C/man3/pthread_create.3:310
3503 #, no-wrap
3504 msgid ""
3505 "    stack_size = -1;\n"
3506 "    while ((opt = getopt(argc, argv, \"s:\")) != -1) {\n"
3507 "        switch (opt) {\n"
3508 "        case \\(aqs\\(aq:\n"
3509 "            stack_size = strtoul(optarg, NULL, 0);\n"
3510 "            break;\n"
3511 msgstr ""
3512
3513 #. type: Plain text
3514 #: build/C/man3/pthread_create.3:317
3515 #, no-wrap
3516 msgid ""
3517 "        default:\n"
3518 "            fprintf(stderr, \"Usage: %s [-s stack-size] arg...\\en\",\n"
3519 "                    argv[0]);\n"
3520 "            exit(EXIT_FAILURE);\n"
3521 "        }\n"
3522 "    }\n"
3523 msgstr ""
3524
3525 #. type: Plain text
3526 #: build/C/man3/pthread_create.3:319
3527 #, no-wrap
3528 msgid "    num_threads = argc - optind;\n"
3529 msgstr ""
3530
3531 #. type: Plain text
3532 #: build/C/man3/pthread_create.3:321
3533 #, no-wrap
3534 msgid "    /* Initialize thread creation attributes */\n"
3535 msgstr ""
3536
3537 #. type: Plain text
3538 #: build/C/man3/pthread_create.3:325
3539 #, no-wrap
3540 msgid ""
3541 "    s = pthread_attr_init(&attr);\n"
3542 "    if (s != 0)\n"
3543 "        handle_error_en(s, \"pthread_attr_init\");\n"
3544 msgstr ""
3545
3546 #. type: Plain text
3547 #: build/C/man3/pthread_create.3:331
3548 #, no-wrap
3549 msgid ""
3550 "    if (stack_size E<gt> 0) {\n"
3551 "        s = pthread_attr_setstacksize(&attr, stack_size);\n"
3552 "        if (s != 0)\n"
3553 "            handle_error_en(s, \"pthread_attr_setstacksize\");\n"
3554 "    }\n"
3555 msgstr ""
3556
3557 #. type: Plain text
3558 #: build/C/man3/pthread_create.3:333
3559 #, no-wrap
3560 msgid "    /* Allocate memory for pthread_create() arguments */\n"
3561 msgstr ""
3562
3563 #. type: Plain text
3564 #: build/C/man3/pthread_create.3:337
3565 #, no-wrap
3566 msgid ""
3567 "    tinfo = calloc(num_threads, sizeof(struct thread_info));\n"
3568 "    if (tinfo == NULL)\n"
3569 "        handle_error(\"calloc\");\n"
3570 msgstr ""
3571
3572 #. type: Plain text
3573 #: build/C/man3/pthread_create.3:339
3574 #, no-wrap
3575 msgid "    /* Create one thread for each command-line argument */\n"
3576 msgstr ""
3577
3578 #. type: Plain text
3579 #: build/C/man3/pthread_create.3:343
3580 #, no-wrap
3581 msgid ""
3582 "    for (tnum = 0; tnum E<lt> num_threads; tnum++) {\n"
3583 "        tinfo[tnum].thread_num = tnum + 1;\n"
3584 "        tinfo[tnum].argv_string = argv[optind + tnum];\n"
3585 msgstr ""
3586
3587 #. type: Plain text
3588 #: build/C/man3/pthread_create.3:346
3589 #, no-wrap
3590 msgid ""
3591 "        /* The pthread_create() call stores the thread ID into\n"
3592 "           corresponding element of tinfo[] */\n"
3593 msgstr ""
3594
3595 #. type: Plain text
3596 #: build/C/man3/pthread_create.3:352
3597 #, no-wrap
3598 msgid ""
3599 "        s = pthread_create(&tinfo[tnum].thread_id, &attr,\n"
3600 "                           &thread_start, &tinfo[tnum]);\n"
3601 "        if (s != 0)\n"
3602 "            handle_error_en(s, \"pthread_create\");\n"
3603 "    }\n"
3604 msgstr ""
3605
3606 #. type: Plain text
3607 #: build/C/man3/pthread_create.3:355
3608 #, no-wrap
3609 msgid ""
3610 "    /* Destroy the thread attributes object, since it is no\n"
3611 "       longer needed */\n"
3612 msgstr ""
3613
3614 #. type: Plain text
3615 #: build/C/man3/pthread_create.3:359
3616 #, no-wrap
3617 msgid ""
3618 "    s = pthread_attr_destroy(&attr);\n"
3619 "    if (s != 0)\n"
3620 "        handle_error_en(s, \"pthread_attr_destroy\");\n"
3621 msgstr ""
3622
3623 #. type: Plain text
3624 #: build/C/man3/pthread_create.3:361
3625 #, no-wrap
3626 msgid "    /* Now join with each thread, and display its returned value */\n"
3627 msgstr ""
3628
3629 #. type: Plain text
3630 #: build/C/man3/pthread_create.3:366
3631 #, no-wrap
3632 msgid ""
3633 "    for (tnum = 0; tnum E<lt> num_threads; tnum++) {\n"
3634 "        s = pthread_join(tinfo[tnum].thread_id, &res);\n"
3635 "        if (s != 0)\n"
3636 "            handle_error_en(s, \"pthread_join\");\n"
3637 msgstr ""
3638
3639 #. type: Plain text
3640 #: build/C/man3/pthread_create.3:371
3641 #, no-wrap
3642 msgid ""
3643 "        printf(\"Joined with thread %d; returned value was %s\\en\",\n"
3644 "                tinfo[tnum].thread_num, (char *) res);\n"
3645 "        free(res);      /* Free memory allocated by thread */\n"
3646 "    }\n"
3647 msgstr ""
3648
3649 #. type: Plain text
3650 #: build/C/man3/pthread_create.3:375
3651 #, no-wrap
3652 msgid ""
3653 "    free(tinfo);\n"
3654 "    exit(EXIT_SUCCESS);\n"
3655 "}\n"
3656 msgstr ""
3657
3658 #. type: Plain text
3659 #: build/C/man3/pthread_create.3:388
3660 msgid ""
3661 "B<getrlimit>(2), B<pthread_attr_init>(3), B<pthread_cancel>(3), "
3662 "B<pthread_detach>(3), B<pthread_equal>(3), B<pthread_exit>(3), "
3663 "B<pthread_getattr_np>(3), B<pthread_join>(3), B<pthread_self>(3), "
3664 "B<pthreads>(7)"
3665 msgstr ""
3666
3667 #. type: TH
3668 #: build/C/man3/pthread_detach.3:26
3669 #, no-wrap
3670 msgid "PTHREAD_DETACH"
3671 msgstr ""
3672
3673 #. type: TH
3674 #: build/C/man3/pthread_detach.3:26 build/C/man3/pthread_join.3:26
3675 #, no-wrap
3676 msgid "2008-11-27"
3677 msgstr ""
3678
3679 #. type: Plain text
3680 #: build/C/man3/pthread_detach.3:29
3681 msgid "pthread_detach - detach a thread"
3682 msgstr ""
3683
3684 #. type: Plain text
3685 #: build/C/man3/pthread_detach.3:34
3686 #, no-wrap
3687 msgid "B<int pthread_detach(pthread_t >I<thread>B<);>\n"
3688 msgstr ""
3689
3690 #. type: Plain text
3691 #: build/C/man3/pthread_detach.3:46
3692 msgid ""
3693 "The B<pthread_detach>()  function marks the thread identified by I<thread> "
3694 "as detached.  When a detached thread terminates, its resources are "
3695 "automatically released back to the system without the need for another "
3696 "thread to join with the terminated thread."
3697 msgstr ""
3698
3699 #. type: Plain text
3700 #: build/C/man3/pthread_detach.3:49
3701 msgid ""
3702 "Attempting to detach an already detached thread results in unspecified "
3703 "behavior."
3704 msgstr ""
3705
3706 #. type: Plain text
3707 #: build/C/man3/pthread_detach.3:54
3708 msgid ""
3709 "On success, B<pthread_detach>()  returns 0; on error, it returns an error "
3710 "number."
3711 msgstr ""
3712
3713 #. type: Plain text
3714 #: build/C/man3/pthread_detach.3:59 build/C/man3/pthread_join.3:89
3715 msgid "I<thread> is not a joinable thread."
3716 msgstr ""
3717
3718 #. type: Plain text
3719 #: build/C/man3/pthread_detach.3:70
3720 msgid ""
3721 "Once a thread has been detached, it can't be joined with B<pthread_join>(3)  "
3722 "or be made joinable again."
3723 msgstr ""
3724
3725 #. type: Plain text
3726 #: build/C/man3/pthread_detach.3:77
3727 msgid ""
3728 "A new thread can be created in a detached state using "
3729 "B<pthread_attr_setdetachstate>(3)  to set the detached attribute of the "
3730 "I<attr> argument of B<pthread_create>(3)."
3731 msgstr ""
3732
3733 #. type: Plain text
3734 #: build/C/man3/pthread_detach.3:84
3735 msgid ""
3736 "The detached attribute merely determines the behavior of the system when the "
3737 "thread terminates; it does not prevent the thread from being terminated if "
3738 "the process terminates using B<exit>(3)  (or equivalently, if the main "
3739 "thread returns)."
3740 msgstr ""
3741
3742 #. type: Plain text
3743 #: build/C/man3/pthread_detach.3:93
3744 msgid ""
3745 "Either B<pthread_join>(3)  or B<pthread_detach>()  should be called for each "
3746 "thread that an application creates, so that system resources for the thread "
3747 "can be released.  (But note that the resources of all threads are freed when "
3748 "the process terminates.)"
3749 msgstr ""
3750
3751 #. type: Plain text
3752 #: build/C/man3/pthread_detach.3:95
3753 msgid "The following statement detaches the calling thread:"
3754 msgstr ""
3755
3756 #. type: Plain text
3757 #: build/C/man3/pthread_detach.3:97
3758 #, no-wrap
3759 msgid "    pthread_detach(pthread_self());\n"
3760 msgstr ""
3761
3762 #. type: Plain text
3763 #: build/C/man3/pthread_detach.3:103
3764 msgid ""
3765 "B<pthread_attr_setdetachstate>(3), B<pthread_cancel>(3), "
3766 "B<pthread_create>(3), B<pthread_exit>(3), B<pthread_join>(3), B<pthreads>(7)"
3767 msgstr ""
3768
3769 #. type: TH
3770 #: build/C/man3/pthread_equal.3:26
3771 #, no-wrap
3772 msgid "PTHREAD_EQUAL"
3773 msgstr ""
3774
3775 #. type: TH
3776 #: build/C/man3/pthread_equal.3:26 build/C/man3/pthread_exit.3:26 build/C/man3/pthread_getcpuclockid.3:26 build/C/man3/pthread_setaffinity_np.3:26 build/C/man3/pthread_setconcurrency.3:25
3777 #, no-wrap
3778 msgid "2014-05-23"
3779 msgstr ""
3780
3781 #. type: Plain text
3782 #: build/C/man3/pthread_equal.3:29
3783 msgid "pthread_equal - compare thread IDs"
3784 msgstr ""
3785
3786 #. type: Plain text
3787 #: build/C/man3/pthread_equal.3:34
3788 #, no-wrap
3789 msgid "B<int pthread_equal(pthread_t >I<t1>B<, pthread_t >I<t2>B<);>\n"
3790 msgstr ""
3791
3792 #. type: Plain text
3793 #: build/C/man3/pthread_equal.3:41
3794 msgid "The B<pthread_equal>()  function compares two thread identifiers."
3795 msgstr ""
3796
3797 #. type: Plain text
3798 #: build/C/man3/pthread_equal.3:45
3799 msgid ""
3800 "If the two thread IDs are equal, B<pthread_equal>()  returns a nonzero "
3801 "value; otherwise, it returns 0."
3802 msgstr ""
3803
3804 #.  SH VERSIONS
3805 #.  Available since glibc 2.0
3806 #. type: Plain text
3807 #: build/C/man3/pthread_equal.3:47 build/C/man3/pthread_exit.3:75 build/C/man3/pthread_self.3:50 build/C/man3/pthread_testcancel.3:58
3808 msgid "This function always succeeds."
3809 msgstr ""
3810
3811 #. type: Plain text
3812 #: build/C/man3/pthread_equal.3:52
3813 msgid "The B<pthread_equal>()  function is thread-safe."
3814 msgstr ""
3815
3816 #. type: Plain text
3817 #: build/C/man3/pthread_equal.3:61
3818 msgid ""
3819 "The B<pthread_equal>()  function is necessary because thread IDs should be "
3820 "considered opaque: there is no portable way for applications to directly "
3821 "compare two I<pthread_t> values."
3822 msgstr ""
3823
3824 #. type: Plain text
3825 #: build/C/man3/pthread_equal.3:64
3826 msgid "B<pthread_create>(3), B<pthread_self>(3), B<pthreads>(7)"
3827 msgstr ""
3828
3829 #. type: TH
3830 #: build/C/man3/pthread_exit.3:26
3831 #, no-wrap
3832 msgid "PTHREAD_EXIT"
3833 msgstr ""
3834
3835 #. type: Plain text
3836 #: build/C/man3/pthread_exit.3:29
3837 msgid "pthread_exit - terminate calling thread"
3838 msgstr ""
3839
3840 #. type: Plain text
3841 #: build/C/man3/pthread_exit.3:34
3842 #, no-wrap
3843 msgid "B<void pthread_exit(void *>I<retval>B<);>\n"
3844 msgstr ""
3845
3846 #. type: Plain text
3847 #: build/C/man3/pthread_exit.3:45
3848 msgid ""
3849 "The B<pthread_exit>()  function terminates the calling thread and returns a "
3850 "value via I<retval> that (if the thread is joinable)  is available to "
3851 "another thread in the same process that calls B<pthread_join>(3)."
3852 msgstr ""
3853
3854 #. type: Plain text
3855 #: build/C/man3/pthread_exit.3:55
3856 msgid ""
3857 "Any clean-up handlers established by B<pthread_cleanup_push>(3)  that have "
3858 "not yet been popped, are popped (in the reverse of the order in which they "
3859 "were pushed)  and executed.  If the thread has any thread-specific data, "
3860 "then, after the clean-up handlers have been executed, the corresponding "
3861 "destructor functions are called, in an unspecified order."
3862 msgstr ""
3863
3864 #. type: Plain text
3865 #: build/C/man3/pthread_exit.3:62
3866 msgid ""
3867 "When a thread terminates, process-shared resources (e.g., mutexes, condition "
3868 "variables, semaphores, and file descriptors) are not released, and functions "
3869 "registered using B<atexit>(3)  are not called."
3870 msgstr ""
3871
3872 #. type: Plain text
3873 #: build/C/man3/pthread_exit.3:71
3874 msgid ""
3875 "After the last thread in a process terminates, the process terminates as by "
3876 "calling B<exit>(3)  with an exit status of zero; thus, process-shared "
3877 "resources are released and functions registered using B<atexit>(3)  are "
3878 "called."
3879 msgstr ""
3880
3881 #. type: Plain text
3882 #: build/C/man3/pthread_exit.3:73
3883 msgid "This function does not return to the caller."
3884 msgstr ""
3885
3886 #. type: Plain text
3887 #: build/C/man3/pthread_exit.3:80
3888 msgid "The B<pthread_exit>()  function is thread-safe."
3889 msgstr ""
3890
3891 #. type: Plain text
3892 #: build/C/man3/pthread_exit.3:87
3893 msgid ""
3894 "Performing a return from the start function of any thread other than the "
3895 "main thread results in an implicit call to B<pthread_exit>(), using the "
3896 "function's return value as the thread's exit status."
3897 msgstr ""
3898
3899 #. type: Plain text
3900 #: build/C/man3/pthread_exit.3:93
3901 msgid ""
3902 "To allow other threads to continue execution, the main thread should "
3903 "terminate by calling B<pthread_exit>()  rather than B<exit>(3)."
3904 msgstr ""
3905
3906 #. type: Plain text
3907 #: build/C/man3/pthread_exit.3:98
3908 msgid ""
3909 "The value pointed to by I<retval> should not be located on the calling "
3910 "thread's stack, since the contents of that stack are undefined after the "
3911 "thread terminates."
3912 msgstr ""
3913
3914 #.  Linux 2.6.27
3915 #.  FIXME . review a later kernel to see if this gets fixed
3916 #.  http://thread.gmane.org/gmane.linux.kernel/611611
3917 #.  http://marc.info/?l=linux-kernel&m=122525468300823&w=2
3918 #. type: Plain text
3919 #: build/C/man3/pthread_exit.3:110
3920 msgid ""
3921 "Currently, there are limitations in the kernel implementation logic for "
3922 "B<wait>(2)ing on a stopped thread group with a dead thread group leader.  "
3923 "This can manifest in problems such as a locked terminal if a stop signal is "
3924 "sent to a foreground process whose thread group leader has already called "
3925 "B<pthread_exit>()."
3926 msgstr ""
3927
3928 #. type: Plain text
3929 #: build/C/man3/pthread_exit.3:113
3930 msgid "B<pthread_create>(3), B<pthread_join>(3), B<pthreads>(7)"
3931 msgstr ""
3932
3933 #. type: TH
3934 #: build/C/man3/pthread_getattr_np.3:26
3935 #, no-wrap
3936 msgid "PTHREAD_GETATTR_NP"
3937 msgstr ""
3938
3939 #. type: TH
3940 #: build/C/man3/pthread_getattr_np.3:26
3941 #, no-wrap
3942 msgid "2010-09-10"
3943 msgstr ""
3944
3945 #. type: Plain text
3946 #: build/C/man3/pthread_getattr_np.3:29
3947 msgid "pthread_getattr_np - get attributes of created thread"
3948 msgstr ""
3949
3950 #. type: Plain text
3951 #: build/C/man3/pthread_getattr_np.3:35
3952 #, no-wrap
3953 msgid ""
3954 "B<int pthread_getattr_np(pthread_t >I<thread>B<, pthread_attr_t "
3955 "*>I<attr>B<);>\n"
3956 msgstr ""
3957
3958 #. type: Plain text
3959 #: build/C/man3/pthread_getattr_np.3:45
3960 msgid ""
3961 "The B<pthread_getattr_np>()  function initializes the thread attributes "
3962 "object referred to by I<attr> so that it contains actual attribute values "
3963 "describing the running thread I<thread>."
3964 msgstr ""
3965
3966 #. type: Plain text
3967 #: build/C/man3/pthread_getattr_np.3:52
3968 msgid ""
3969 "The returned attribute values may differ from the corresponding attribute "
3970 "values passed in the I<attr> object that was used to create the thread using "
3971 "B<pthread_create>(3).  In particular, the following attributes may differ:"
3972 msgstr ""
3973
3974 #. type: Plain text
3975 #: build/C/man3/pthread_getattr_np.3:55
3976 msgid ""
3977 "the detach state, since a joinable thread may have detached itself after "
3978 "creation;"
3979 msgstr ""
3980
3981 #. type: Plain text
3982 #: build/C/man3/pthread_getattr_np.3:58
3983 msgid "the stack size, which the implementation may align to a suitable boundary."
3984 msgstr ""
3985
3986 #. type: Plain text
3987 #: build/C/man3/pthread_getattr_np.3:63
3988 msgid ""
3989 "and the guard size, which the implementation may round upward to a multiple "
3990 "of the page size, or ignore (i.e., treat as 0), if the application is "
3991 "allocating its own stack."
3992 msgstr ""
3993
3994 #. type: Plain text
3995 #: build/C/man3/pthread_getattr_np.3:68
3996 msgid ""
3997 "Furthermore, if the stack address attribute was not set in the thread "
3998 "attributes object used to create the thread, then the returned thread "
3999 "attributes object will report the actual stack address that the "
4000 "implementation selected for the thread."
4001 msgstr ""
4002
4003 #. type: Plain text
4004 #: build/C/man3/pthread_getattr_np.3:73
4005 msgid ""
4006 "When the thread attributes object returned by B<pthread_getattr_np>()  is no "
4007 "longer required, it should be destroyed using B<pthread_attr_destroy>(3)."
4008 msgstr ""
4009
4010 #. type: Plain text
4011 #: build/C/man3/pthread_getattr_np.3:76 build/C/man3/pthread_getcpuclockid.3:49
4012 msgid ""
4013 "On success, this function returns 0; on error, it returns a nonzero error "
4014 "number."
4015 msgstr ""
4016
4017 #.  Can happen (but unlikely) while trying to allocate memory for cpuset
4018 #. type: Plain text
4019 #: build/C/man3/pthread_getattr_np.3:81
4020 msgid "Insufficient memory."
4021 msgstr ""
4022
4023 #. type: Plain text
4024 #: build/C/man3/pthread_getattr_np.3:96
4025 msgid ""
4026 "In addition, if I<thread> refers to the main thread, then "
4027 "B<pthread_getattr_np>()  can fail because of errors from various underlying "
4028 "calls: B<fopen>(3), if I</proc/self/maps> can't be opened; and "
4029 "B<getrlimit>(2), if the B<RLIMIT_STACK> resource limit is not supported."
4030 msgstr ""
4031
4032 #. type: Plain text
4033 #: build/C/man3/pthread_getattr_np.3:98
4034 msgid "This function is available in glibc since version 2.2.3."
4035 msgstr ""
4036
4037 #. type: Plain text
4038 #: build/C/man3/pthread_getattr_np.3:101 build/C/man3/pthread_kill_other_threads_np.3:55
4039 msgid ""
4040 "This function is a nonstandard GNU extension; hence the suffix \"_np\" "
4041 "(nonportable) in the name."
4042 msgstr ""
4043
4044 #. type: Plain text
4045 #: build/C/man3/pthread_getattr_np.3:111
4046 msgid ""
4047 "The program below demonstrates the use of B<pthread_getattr_np>().  The "
4048 "program creates a thread that then uses B<pthread_getattr_np>()  to retrieve "
4049 "and display its guard size, stack address, and stack size attributes.  "
4050 "Command-line arguments can be used to set these attributes to values other "
4051 "than the default when creating the thread.  The shell sessions below "
4052 "demonstrate the use of the program."
4053 msgstr ""
4054
4055 #. type: Plain text
4056 #: build/C/man3/pthread_getattr_np.3:114
4057 msgid ""
4058 "In the first run, on an x86-32 system, a thread is created using default "
4059 "attributes:"
4060 msgstr ""
4061
4062 #. type: Plain text
4063 #: build/C/man3/pthread_getattr_np.3:124
4064 #, no-wrap
4065 msgid ""
4066 "$B< ulimit -s>      # No stack limit ==E<gt> default stack size is 2MB\n"
4067 "unlimited\n"
4068 "$B< ./a.out>\n"
4069 "Attributes of created thread:\n"
4070 "        Guard size          = 4096 bytes\n"
4071 "        Stack address       = 0x40196000 (EOS = 0x40397000)\n"
4072 "        Stack size          = 0x201000 (2101248) bytes\n"
4073 msgstr ""
4074
4075 #. type: Plain text
4076 #: build/C/man3/pthread_getattr_np.3:130
4077 msgid ""
4078 "In the following run, we see that if a guard size is specified, it is "
4079 "rounded up to the next multiple of the system page size (4096 bytes on "
4080 "x86-32):"
4081 msgstr ""
4082
4083 #. type: Plain text
4084 #: build/C/man3/pthread_getattr_np.3:138
4085 #, no-wrap
4086 msgid ""
4087 "$B< ./a.out -g 4097>\n"
4088 "Thread attributes object after initializations:\n"
4089 "        Guard size          = 4097 bytes\n"
4090 "        Stack address       = (nil)\n"
4091 "        Stack size          = 0x0 (0) bytes\n"
4092 msgstr ""
4093
4094 #. type: Plain text
4095 #: build/C/man3/pthread_getattr_np.3:143
4096 #, no-wrap
4097 msgid ""
4098 "Attributes of created thread:\n"
4099 "        Guard size          = 8192 bytes\n"
4100 "        Stack address       = 0x40196000 (EOS = 0x40397000)\n"
4101 "        Stack size          = 0x201000 (2101248) bytes\n"
4102 msgstr ""
4103
4104 #. .in +4n
4105 #. .nf
4106 #. $ ./a.out \-s 0x8000
4107 #. Thread attributes object after initializations:
4108 #.         Guard size          = 4096 bytes
4109 #.         Stack address       = 0xffff8000 (EOS = (nil))
4110 #.         Stack size          = 0x8000 (32768) bytes
4111 #
4112 #. Attributes of created thread:
4113 #.         Guard size          = 4096 bytes
4114 #.         Stack address       = 0x4001e000 (EOS = 0x40026000)
4115 #.         Stack size          = 0x8000 (32768) bytes
4116 #. .fi
4117 #. .in
4118 #. type: Plain text
4119 #: build/C/man3/pthread_getattr_np.3:162
4120 msgid ""
4121 "In the last run, the program manually allocates a stack for the thread.  In "
4122 "this case, the guard size attribute is ignored."
4123 msgstr ""
4124
4125 #. type: Plain text
4126 #: build/C/man3/pthread_getattr_np.3:167
4127 #, no-wrap
4128 msgid ""
4129 "$B< ./a.out -g 4096 -s 0x8000 -a>\n"
4130 "Allocated thread stack at 0x804d000\n"
4131 msgstr ""
4132
4133 #. type: Plain text
4134 #: build/C/man3/pthread_getattr_np.3:172
4135 #, no-wrap
4136 msgid ""
4137 "Thread attributes object after initializations:\n"
4138 "        Guard size          = 4096 bytes\n"
4139 "        Stack address       = 0x804d000 (EOS = 0x8055000)\n"
4140 "        Stack size          = 0x8000 (32768) bytes\n"
4141 msgstr ""
4142
4143 #. type: Plain text
4144 #: build/C/man3/pthread_getattr_np.3:177
4145 #, no-wrap
4146 msgid ""
4147 "Attributes of created thread:\n"
4148 "        Guard size          = 0 bytes\n"
4149 "        Stack address       = 0x804d000 (EOS = 0x8055000)\n"
4150 "        Stack size          = 0x8000 (32768) bytes\n"
4151 msgstr ""
4152
4153 #. type: Plain text
4154 #: build/C/man3/pthread_getattr_np.3:198
4155 #, no-wrap
4156 msgid ""
4157 "static void\n"
4158 "display_stack_related_attributes(pthread_attr_t *attr, char *prefix)\n"
4159 "{\n"
4160 "    int s;\n"
4161 "    size_t stack_size, guard_size;\n"
4162 "    void *stack_addr;\n"
4163 msgstr ""
4164
4165 #. type: Plain text
4166 #: build/C/man3/pthread_getattr_np.3:203
4167 #, no-wrap
4168 msgid ""
4169 "    s = pthread_attr_getguardsize(attr, &guard_size);\n"
4170 "    if (s != 0)\n"
4171 "        handle_error_en(s, \"pthread_attr_getguardsize\");\n"
4172 "    printf(\"%sGuard size          = %d bytes\\en\", prefix, guard_size);\n"
4173 msgstr ""
4174
4175 #. type: Plain text
4176 #: build/C/man3/pthread_getattr_np.3:214
4177 #, no-wrap
4178 msgid ""
4179 "    s = pthread_attr_getstack(attr, &stack_addr, &stack_size);\n"
4180 "    if (s != 0)\n"
4181 "        handle_error_en(s, \"pthread_attr_getstack\");\n"
4182 "    printf(\"%sStack address       = %p\", prefix, stack_addr);\n"
4183 "    if (stack_size E<gt> 0)\n"
4184 "        printf(\" (EOS = %p)\", (char *) stack_addr + stack_size);\n"
4185 "    printf(\"\\en\");\n"
4186 "    printf(\"%sStack size          = 0x%x (%d) bytes\\en\",\n"
4187 "            prefix, stack_size, stack_size);\n"
4188 "}\n"
4189 msgstr ""
4190
4191 #. type: Plain text
4192 #: build/C/man3/pthread_getattr_np.3:220
4193 #, no-wrap
4194 msgid ""
4195 "static void\n"
4196 "display_thread_attributes(pthread_t thread, char *prefix)\n"
4197 "{\n"
4198 "    int s;\n"
4199 "    pthread_attr_t attr;\n"
4200 msgstr ""
4201
4202 #. type: Plain text
4203 #: build/C/man3/pthread_getattr_np.3:224
4204 #, no-wrap
4205 msgid ""
4206 "    s = pthread_getattr_np(thread, &attr);\n"
4207 "    if (s != 0)\n"
4208 "        handle_error_en(s, \"pthread_getattr_np\");\n"
4209 msgstr ""
4210
4211 #. type: Plain text
4212 #: build/C/man3/pthread_getattr_np.3:226
4213 #, no-wrap
4214 msgid "    display_stack_related_attributes(&attr, prefix);\n"
4215 msgstr ""
4216
4217 #. type: Plain text
4218 #: build/C/man3/pthread_getattr_np.3:231
4219 #, no-wrap
4220 msgid ""
4221 "    s = pthread_attr_destroy(&attr);\n"
4222 "    if (s != 0)\n"
4223 "        handle_error_en(s, \"pthread_attr_destroy\");\n"
4224 "}\n"
4225 msgstr ""
4226
4227 #. type: Plain text
4228 #: build/C/man3/pthread_getattr_np.3:237
4229 #, no-wrap
4230 msgid ""
4231 "static void *           /* Start function for thread we create */\n"
4232 "thread_start(void *arg)\n"
4233 "{\n"
4234 "    printf(\"Attributes of created thread:\\en\");\n"
4235 "    display_thread_attributes(pthread_self(), \"\\et\");\n"
4236 msgstr ""
4237
4238 #. type: Plain text
4239 #: build/C/man3/pthread_getattr_np.3:251
4240 #, no-wrap
4241 msgid ""
4242 "static void\n"
4243 "usage(char *pname, char *msg)\n"
4244 "{\n"
4245 "    if (msg != NULL)\n"
4246 "        fputs(msg, stderr);\n"
4247 "    fprintf(stderr, \"Usage: %s [-s stack-size [-a]]\"\n"
4248 "            \" [-g guard-size]\\en\", pname);\n"
4249 "    fprintf(stderr, \"\\et\\et-a means program should allocate "
4250 "stack\\en\");\n"
4251 "    exit(EXIT_FAILURE);\n"
4252 "}\n"
4253 msgstr ""
4254
4255 #. type: Plain text
4256 #: build/C/man3/pthread_getattr_np.3:264
4257 #, no-wrap
4258 msgid ""
4259 "static pthread_attr_t *   /* Get thread attributes from command line */\n"
4260 "get_thread_attributes_from_cl(int argc, char *argv[],\n"
4261 "                              pthread_attr_t *attrp)\n"
4262 "{\n"
4263 "    int s, opt, allocate_stack;\n"
4264 "    long stack_size, guard_size;\n"
4265 "            void *stack_addr;\n"
4266 "    pthread_attr_t *ret_attrp = NULL;   /* Set to attrp if we initialize\n"
4267 "                                           a thread attributes object */\n"
4268 "    allocate_stack = 0;\n"
4269 "    stack_size = -1;\n"
4270 "    guard_size = -1;\n"
4271 msgstr ""
4272
4273 #. type: Plain text
4274 #: build/C/man3/pthread_getattr_np.3:273
4275 #, no-wrap
4276 msgid ""
4277 "    while ((opt = getopt(argc, argv, \"ag:s:\")) != -1) {\n"
4278 "        switch (opt) {\n"
4279 "        case \\(aqa\\(aq:   allocate_stack = 1;                     break;\n"
4280 "        case \\(aqg\\(aq:   guard_size = strtoul(optarg, NULL, 0);  break;\n"
4281 "        case \\(aqs\\(aq:   stack_size = strtoul(optarg, NULL, 0);  break;\n"
4282 "        default:    usage(argv[0], NULL);\n"
4283 "        }\n"
4284 "    }\n"
4285 msgstr ""
4286
4287 #. type: Plain text
4288 #: build/C/man3/pthread_getattr_np.3:276
4289 #, no-wrap
4290 msgid ""
4291 "    if (allocate_stack && stack_size == -1)\n"
4292 "        usage(argv[0], \"Specifying -a without -s makes no sense\\en\");\n"
4293 msgstr ""
4294
4295 #. type: Plain text
4296 #: build/C/man3/pthread_getattr_np.3:279
4297 #, no-wrap
4298 msgid ""
4299 "    if (argc E<gt> optind)\n"
4300 "        usage(argv[0], \"Extraneous command-line arguments\\en\");\n"
4301 msgstr ""
4302
4303 #. type: Plain text
4304 #: build/C/man3/pthread_getattr_np.3:282
4305 #, no-wrap
4306 msgid ""
4307 "    if (stack_size E<gt>= 0 || guard_size E<gt> 0) {\n"
4308 "        ret_attrp = attrp;\n"
4309 msgstr ""
4310
4311 #. type: Plain text
4312 #: build/C/man3/pthread_getattr_np.3:287
4313 #, no-wrap
4314 msgid ""
4315 "        s = pthread_attr_init(attrp);\n"
4316 "        if (s != 0)\n"
4317 "            handle_error_en(s, \"pthread_attr_init\");\n"
4318 "    }\n"
4319 msgstr ""
4320
4321 #. type: Plain text
4322 #: build/C/man3/pthread_getattr_np.3:299
4323 #, no-wrap
4324 msgid ""
4325 "    if (stack_size E<gt>= 0) {\n"
4326 "        if (!allocate_stack) {\n"
4327 "            s = pthread_attr_setstacksize(attrp, stack_size);\n"
4328 "            if (s != 0)\n"
4329 "                handle_error_en(s, \"pthread_attr_setstacksize\");\n"
4330 "        } else {\n"
4331 "            s = posix_memalign(&stack_addr, sysconf(_SC_PAGESIZE),\n"
4332 "                               stack_size);\n"
4333 "            if (s != 0)\n"
4334 "                handle_error_en(s, \"posix_memalign\");\n"
4335 "            printf(\"Allocated thread stack at %p\\en\\en\", stack_addr);\n"
4336 msgstr ""
4337
4338 #. type: Plain text
4339 #: build/C/man3/pthread_getattr_np.3:305
4340 #, no-wrap
4341 msgid ""
4342 "            s = pthread_attr_setstack(attrp, stack_addr, stack_size);\n"
4343 "            if (s != 0)\n"
4344 "                handle_error_en(s, \"pthread_attr_setstacksize\");\n"
4345 "        }\n"
4346 "    }\n"
4347 msgstr ""
4348
4349 #. type: Plain text
4350 #: build/C/man3/pthread_getattr_np.3:311
4351 #, no-wrap
4352 msgid ""
4353 "    if (guard_size E<gt>= 0) {\n"
4354 "        s = pthread_attr_setguardsize(attrp, guard_size);\n"
4355 "        if (s != 0)\n"
4356 "            handle_error_en(s, \"pthread_attr_setstacksize\");\n"
4357 "    }\n"
4358 msgstr ""
4359
4360 #. type: Plain text
4361 #: build/C/man3/pthread_getattr_np.3:314
4362 #, no-wrap
4363 msgid ""
4364 "    return ret_attrp;\n"
4365 "}\n"
4366 msgstr ""
4367
4368 #. type: Plain text
4369 #: build/C/man3/pthread_getattr_np.3:323
4370 #, no-wrap
4371 msgid ""
4372 "int\n"
4373 "main(int argc, char *argv[])\n"
4374 "{\n"
4375 "    int s;\n"
4376 "    pthread_t thr;\n"
4377 "    pthread_attr_t attr;\n"
4378 "    pthread_attr_t *attrp = NULL;    /* Set to &attr if we initialize\n"
4379 "                                        a thread attributes object */\n"
4380 msgstr ""
4381
4382 #. type: Plain text
4383 #: build/C/man3/pthread_getattr_np.3:325
4384 #, no-wrap
4385 msgid "    attrp = get_thread_attributes_from_cl(argc, argv, &attr);\n"
4386 msgstr ""
4387
4388 #. type: Plain text
4389 #: build/C/man3/pthread_getattr_np.3:331
4390 #, no-wrap
4391 msgid ""
4392 "    if (attrp != NULL) {\n"
4393 "        printf(\"Thread attributes object after initializations:\\en\");\n"
4394 "        display_stack_related_attributes(attrp, \"\\et\");\n"
4395 "        printf(\"\\en\");\n"
4396 "    }\n"
4397 msgstr ""
4398
4399 #. type: Plain text
4400 #: build/C/man3/pthread_getattr_np.3:360
4401 msgid ""
4402 "B<pthread_attr_getaffinity_np>(3), B<pthread_attr_getdetachstate>(3), "
4403 "B<pthread_attr_getguardsize>(3), B<pthread_attr_getinheritsched>(3), "
4404 "B<pthread_attr_getschedparam>(3), B<pthread_attr_getschedpolicy>(3), "
4405 "B<pthread_attr_getscope>(3), B<pthread_attr_getstack>(3), "
4406 "B<pthread_attr_getstackaddr>(3), B<pthread_attr_getstacksize>(3), "
4407 "B<pthread_attr_init>(3), B<pthread_create>(3), B<pthreads>(7)"
4408 msgstr ""
4409
4410 #. type: TH
4411 #: build/C/man3/pthread_getcpuclockid.3:26
4412 #, no-wrap
4413 msgid "PTHREAD_GETCPUCLOCKID"
4414 msgstr ""
4415
4416 #. type: Plain text
4417 #: build/C/man3/pthread_getcpuclockid.3:29
4418 msgid "pthread_getcpuclockid - retrieve ID of a thread's CPU time clock"
4419 msgstr ""
4420
4421 #. type: Plain text
4422 #: build/C/man3/pthread_getcpuclockid.3:33
4423 #, no-wrap
4424 msgid ""
4425 "B<#include E<lt>pthread.hE<gt>>\n"
4426 "B<#include E<lt>time.hE<gt>>\n"
4427 msgstr ""
4428
4429 #. type: Plain text
4430 #: build/C/man3/pthread_getcpuclockid.3:35
4431 #, no-wrap
4432 msgid ""
4433 "B<int pthread_getcpuclockid(pthread_t >I<thread>B<, clockid_t "
4434 "*>I<clock_id>B<);>\n"
4435 msgstr ""
4436
4437 #.  The clockid is constructed as follows:
4438 #.  *clockid = CLOCK_THREAD_CPUTIME_ID | (pd->tid << CLOCK_IDFIELD_SIZE)
4439 #.  where CLOCK_IDFIELD_SIZE is 3.
4440 #. type: Plain text
4441 #: build/C/man3/pthread_getcpuclockid.3:46
4442 msgid ""
4443 "The B<pthread_getcpuclockid>()  function returns the clock ID for the CPU "
4444 "time clock of the thread I<thread>."
4445 msgstr ""
4446
4447 #. type: TP
4448 #: build/C/man3/pthread_getcpuclockid.3:50
4449 #, no-wrap
4450 msgid "B<ENOENT>"
4451 msgstr ""
4452
4453 #.  CLOCK_THREAD_CPUTIME_ID not defined
4454 #
4455 #.  Looking at nptl/pthread_getcpuclockid.c an ERANGE error would
4456 #.  be possible if kernel thread IDs took more than 29 bits (which
4457 #.  they currently cannot).
4458 #. type: Plain text
4459 #: build/C/man3/pthread_getcpuclockid.3:58
4460 msgid "Per-thread CPU time clocks are not supported by the system."
4461 msgstr ""
4462
4463 #. type: Plain text
4464 #: build/C/man3/pthread_getcpuclockid.3:65
4465 msgid "This function is available in glibc since version 2.2."
4466 msgstr ""
4467
4468 #. type: Plain text
4469 #: build/C/man3/pthread_getcpuclockid.3:70
4470 msgid "The B<pthread_getcpuclockid>()  function is thread-safe."
4471 msgstr ""
4472
4473 #. type: Plain text
4474 #: build/C/man3/pthread_getcpuclockid.3:83
4475 msgid ""
4476 "When I<thread> refers to the calling thread, this function returns an "
4477 "identifier that refers to the same clock manipulated by B<clock_gettime>(2)  "
4478 "and B<clock_settime>(2)  when given the clock ID B<CLOCK_THREAD_CPUTIME_ID>."
4479 msgstr ""
4480
4481 #. type: Plain text
4482 #: build/C/man3/pthread_getcpuclockid.3:89
4483 msgid ""
4484 "The program below creates a thread and then uses B<clock_gettime>(2)  to "
4485 "retrieve the total process CPU time, and the per-thread CPU time consumed by "
4486 "the two threads.  The following shell session shows an example run:"
4487 msgstr ""
4488
4489 #. type: Plain text
4490 #: build/C/man3/pthread_getcpuclockid.3:99
4491 #, no-wrap
4492 msgid ""
4493 "$ B<./a.out>\n"
4494 "Main thread sleeping\n"
4495 "Subthread starting infinite loop\n"
4496 "Main thread consuming some CPU time...\n"
4497 "Process total CPU time:    1.368\n"
4498 "Main thread CPU time:      0.376\n"
4499 "Subthread CPU time:        0.992\n"
4500 msgstr ""
4501
4502 #. type: Plain text
4503 #: build/C/man3/pthread_getcpuclockid.3:105
4504 #, no-wrap
4505 msgid "/* Link with \"-lrt\" */\n"
4506 msgstr ""
4507
4508 #. type: Plain text
4509 #: build/C/man3/pthread_getcpuclockid.3:113
4510 #, no-wrap
4511 msgid ""
4512 "#include E<lt>time.hE<gt>\n"
4513 "#include E<lt>stdio.hE<gt>\n"
4514 "#include E<lt>stdlib.hE<gt>\n"
4515 "#include E<lt>unistd.hE<gt>\n"
4516 "#include E<lt>pthread.hE<gt>\n"
4517 "#include E<lt>string.hE<gt>\n"
4518 "#include E<lt>errno.hE<gt>\n"
4519 msgstr ""
4520
4521 #. type: Plain text
4522 #: build/C/man3/pthread_getcpuclockid.3:127
4523 #, no-wrap
4524 msgid ""
4525 "static void *\n"
4526 "thread_start(void *arg)\n"
4527 "{\n"
4528 "    printf(\"Subthread starting infinite loop\\en\");\n"
4529 "    for (;;)\n"
4530 "        continue;\n"
4531 "}\n"
4532 msgstr ""
4533
4534 #. type: Plain text
4535 #: build/C/man3/pthread_getcpuclockid.3:132
4536 #, no-wrap
4537 msgid ""
4538 "static void\n"
4539 "pclock(char *msg, clockid_t cid)\n"
4540 "{\n"
4541 "    struct timespec ts;\n"
4542 msgstr ""
4543
4544 #. type: Plain text
4545 #: build/C/man3/pthread_getcpuclockid.3:138
4546 #, no-wrap
4547 msgid ""
4548 "    printf(\"%s\", msg);\n"
4549 "    if (clock_gettime(cid, &ts) == -1)\n"
4550 "        handle_error(\"clock_gettime\");\n"
4551 "    printf(\"%4ld.%03ld\\en\", ts.tv_sec, ts.tv_nsec / 1000000);\n"
4552 "}\n"
4553 msgstr ""
4554
4555 #. type: Plain text
4556 #: build/C/man3/pthread_getcpuclockid.3:145
4557 #, no-wrap
4558 msgid ""
4559 "int\n"
4560 "main(int argc, char *argv[])\n"
4561 "{\n"
4562 "    pthread_t thread;\n"
4563 "    clockid_t cid;\n"
4564 "    int j, s;\n"
4565 msgstr ""
4566
4567 #. type: Plain text
4568 #: build/C/man3/pthread_getcpuclockid.3:149
4569 #, no-wrap
4570 msgid ""
4571 "    s = pthread_create(&thread, NULL, thread_start, NULL);\n"
4572 "    if (s != 0)\n"
4573 "        handle_error_en(s, \"pthread_create\");\n"
4574 msgstr ""
4575
4576 #. type: Plain text
4577 #: build/C/man3/pthread_getcpuclockid.3:152
4578 #, no-wrap
4579 msgid ""
4580 "    printf(\"Main thread sleeping\\en\");\n"
4581 "    sleep(1);\n"
4582 msgstr ""
4583
4584 #. type: Plain text
4585 #: build/C/man3/pthread_getcpuclockid.3:156
4586 #, no-wrap
4587 msgid ""
4588 "    printf(\"Main thread consuming some CPU time...\\en\");\n"
4589 "    for (j = 0; j E<lt> 2000000; j++)\n"
4590 "        getppid();\n"
4591 msgstr ""
4592
4593 #. type: Plain text
4594 #: build/C/man3/pthread_getcpuclockid.3:158
4595 #, no-wrap
4596 msgid "    pclock(\"Process total CPU time: \", CLOCK_PROCESS_CPUTIME_ID);\n"
4597 msgstr ""
4598
4599 #. type: Plain text
4600 #: build/C/man3/pthread_getcpuclockid.3:163
4601 #, no-wrap
4602 msgid ""
4603 "    s = pthread_getcpuclockid(pthread_self(), &cid);\n"
4604 "    if (s != 0)\n"
4605 "        handle_error_en(s, \"pthread_getcpuclockid\");\n"
4606 "    pclock(\"Main thread CPU time:   \", cid);\n"
4607 msgstr ""
4608
4609 #. type: Plain text
4610 #: build/C/man3/pthread_getcpuclockid.3:166
4611 #, no-wrap
4612 msgid ""
4613 "    /* The preceding 4 lines of code could have been replaced by:\n"
4614 "       pclock(\"Main thread CPU time:   \", CLOCK_THREAD_CPUTIME_ID); */\n"
4615 msgstr ""
4616
4617 #. type: Plain text
4618 #: build/C/man3/pthread_getcpuclockid.3:171
4619 #, no-wrap
4620 msgid ""
4621 "    s = pthread_getcpuclockid(thread, &cid);\n"
4622 "    if (s != 0)\n"
4623 "        handle_error_en(s, \"pthread_getcpuclockid\");\n"
4624 "    pclock(\"Subthread CPU time: 1    \", cid);\n"
4625 msgstr ""
4626
4627 #. type: Plain text
4628 #: build/C/man3/pthread_getcpuclockid.3:174
4629 #, no-wrap
4630 msgid ""
4631 "    exit(EXIT_SUCCESS);         /* Terminates both threads */\n"
4632 "}\n"
4633 msgstr ""
4634
4635 #. type: Plain text
4636 #: build/C/man3/pthread_getcpuclockid.3:182
4637 msgid ""
4638 "B<clock_gettime>(2), B<clock_settime>(2), B<timer_create>(2), "
4639 "B<clock_getcpuclockid>(3), B<pthread_self>(3), B<pthreads>(7), B<time>(7)"
4640 msgstr ""
4641
4642 #. type: TH
4643 #: build/C/man3/pthread_join.3:26
4644 #, no-wrap
4645 msgid "PTHREAD_JOIN"
4646 msgstr ""
4647
4648 #. type: Plain text
4649 #: build/C/man3/pthread_join.3:29
4650 msgid "pthread_join - join with a terminated thread"
4651 msgstr ""
4652
4653 #. type: Plain text
4654 #: build/C/man3/pthread_join.3:34
4655 #, no-wrap
4656 msgid "B<int pthread_join(pthread_t >I<thread>B<, void **>I<retval>B<);>\n"
4657 msgstr ""
4658
4659 #. type: Plain text
4660 #: build/C/man3/pthread_join.3:49
4661 msgid ""
4662 "The B<pthread_join>()  function waits for the thread specified by I<thread> "
4663 "to terminate.  If that thread has already terminated, then B<pthread_join>()  "
4664 "returns immediately.  The thread specified by I<thread> must be joinable."
4665 msgstr ""
4666
4667 #. type: Plain text
4668 #: build/C/man3/pthread_join.3:63
4669 msgid ""
4670 "If I<retval> is not NULL, then B<pthread_join>()  copies the exit status of "
4671 "the target thread (i.e., the value that the target thread supplied to "
4672 "B<pthread_exit>(3))  into the location pointed to by I<*retval>.  If the "
4673 "target thread was canceled, then B<PTHREAD_CANCELED> is placed in "
4674 "I<*retval>."
4675 msgstr ""
4676
4677 #. type: Plain text
4678 #: build/C/man3/pthread_join.3:70
4679 msgid ""
4680 "If multiple threads simultaneously try to join with the same thread, the "
4681 "results are undefined.  If the thread calling B<pthread_join>()  is "
4682 "canceled, then the target thread will remain joinable (i.e., it will not be "
4683 "detached)."
4684 msgstr ""
4685
4686 #. type: Plain text
4687 #: build/C/man3/pthread_join.3:75
4688 msgid ""
4689 "On success, B<pthread_join>()  returns 0; on error, it returns an error "
4690 "number."
4691 msgstr ""
4692
4693 #. type: TP
4694 #: build/C/man3/pthread_join.3:76
4695 #, no-wrap
4696 msgid "B<EDEADLK>"
4697 msgstr ""
4698
4699 #.  The following verified by testing on glibc 2.8/NPTL:
4700 #.  The following verified by testing on glibc 2.8/NPTL:
4701 #. type: Plain text
4702 #: build/C/man3/pthread_join.3:85
4703 msgid ""
4704 "A deadlock was detected (e.g., two threads tried to join with each other); "
4705 "or I<thread> specifies the calling thread."
4706 msgstr ""
4707
4708 #.  POSIX.1-2001 does not specify this error case.
4709 #. type: Plain text
4710 #: build/C/man3/pthread_join.3:93
4711 msgid "Another thread is already waiting to join with this thread."
4712 msgstr ""
4713
4714 #. type: Plain text
4715 #: build/C/man3/pthread_join.3:104
4716 msgid ""
4717 "After a successful call to B<pthread_join>(), the caller is guaranteed that "
4718 "the target thread has terminated."
4719 msgstr ""
4720
4721 #. type: Plain text
4722 #: build/C/man3/pthread_join.3:107
4723 msgid ""
4724 "Joining with a thread that has previously been joined results in undefined "
4725 "behavior."
4726 msgstr ""
4727
4728 #. type: Plain text
4729 #: build/C/man3/pthread_join.3:115
4730 msgid ""
4731 "Failure to join with a thread that is joinable (i.e., one that is not "
4732 "detached), produces a \"zombie thread\".  Avoid doing this, since each "
4733 "zombie thread consumes some system resources, and when enough zombie threads "
4734 "have accumulated, it will no longer be possible to create new threads (or "
4735 "processes)."
4736 msgstr ""
4737
4738 #. type: Plain text
4739 #: build/C/man3/pthread_join.3:121
4740 msgid ""
4741 "There is no pthreads analog of I<waitpid(-1,\\ &status,\\ 0)>, that is, "
4742 "\"join with any terminated thread\".  If you believe you need this "
4743 "functionality, you probably need to rethink your application design."
4744 msgstr ""
4745
4746 #. type: Plain text
4747 #: build/C/man3/pthread_join.3:124
4748 msgid ""
4749 "All of the threads in a process are peers: any thread can join with any "
4750 "other thread in the process."
4751 msgstr ""
4752
4753 #. type: Plain text
4754 #: build/C/man3/pthread_join.3:133
4755 msgid ""
4756 "B<pthread_cancel>(3), B<pthread_create>(3), B<pthread_detach>(3), "
4757 "B<pthread_exit>(3), B<pthread_tryjoin_np>(3), B<pthreads>(7)"
4758 msgstr ""
4759
4760 #. type: TH
4761 #: build/C/man3/pthread_kill.3:26
4762 #, no-wrap
4763 msgid "PTHREAD_KILL"
4764 msgstr ""
4765
4766 #. type: TH
4767 #: build/C/man3/pthread_kill.3:26 build/C/man3/pthread_kill_other_threads_np.3:26 build/C/man3/pthread_self.3:26 build/C/man3/pthread_setcancelstate.3:26 build/C/man3/pthread_yield.3:25
4768 #, no-wrap
4769 msgid "2014-05-13"
4770 msgstr ""
4771
4772 #. type: Plain text
4773 #: build/C/man3/pthread_kill.3:29
4774 msgid "pthread_kill - send a signal to a thread"
4775 msgstr ""
4776
4777 #. type: Plain text
4778 #: build/C/man3/pthread_kill.3:32 build/C/man3/pthread_sigmask.3:32
4779 #, no-wrap
4780 msgid "B<#include E<lt>signal.hE<gt>>\n"
4781 msgstr ""
4782
4783 #. type: Plain text
4784 #: build/C/man3/pthread_kill.3:34
4785 #, no-wrap
4786 msgid "B<int pthread_kill(pthread_t >I<thread>B<, int >I<sig>B<);>\n"
4787 msgstr ""
4788
4789 #. type: Plain text
4790 #: build/C/man3/pthread_kill.3:45
4791 msgid "B<pthread_kill>():"
4792 msgstr ""
4793
4794 #. type: Plain text
4795 #: build/C/man3/pthread_kill.3:47 build/C/man3/pthread_sigmask.3:48
4796 msgid "_POSIX_C_SOURCE\\ E<gt>=\\ 199506L || _XOPEN_SOURCE\\ E<gt>=\\ 500"
4797 msgstr ""
4798
4799 #. type: Plain text
4800 #: build/C/man3/pthread_kill.3:59
4801 msgid ""
4802 "The B<pthread_kill>()  function sends the signal I<sig> to I<thread>, a "
4803 "thread in the same process as the caller.  The signal is asynchronously "
4804 "directed to I<thread>."
4805 msgstr ""
4806
4807 #. type: Plain text
4808 #: build/C/man3/pthread_kill.3:63
4809 msgid ""
4810 "If I<sig> is 0, then no signal is sent, but error checking is still "
4811 "performed."
4812 msgstr ""
4813
4814 #. type: Plain text
4815 #: build/C/man3/pthread_kill.3:68
4816 msgid ""
4817 "On success, B<pthread_kill>()  returns 0; on error, it returns an error "
4818 "number, and no signal is sent."
4819 msgstr ""
4820
4821 #. type: Plain text
4822 #: build/C/man3/pthread_kill.3:72
4823 msgid "An invalid signal was specified."
4824 msgstr ""
4825
4826 #. type: Plain text
4827 #: build/C/man3/pthread_kill.3:77
4828 msgid "The B<pthread_kill>()  function is thread-safe."
4829 msgstr ""
4830
4831 #. type: Plain text
4832 #: build/C/man3/pthread_kill.3:79
4833 msgid "POSIX.1-2008."
4834 msgstr ""
4835
4836 #. type: Plain text
4837 #: build/C/man3/pthread_kill.3:86
4838 msgid ""
4839 "Signal dispositions are process-wide: if a signal handler is installed, the "
4840 "handler will be invoked in the thread I<thread>, but if the disposition of "
4841 "the signal is \"stop\", \"continue\", or \"terminate\", this action will "
4842 "affect the whole process."
4843 msgstr ""
4844
4845 #. type: Plain text
4846 #: build/C/man3/pthread_kill.3:99
4847 msgid ""
4848 "POSIX.1-2008 recommends that if an implementation detects the use of a "
4849 "thread ID after the end of its lifetime, B<pthread_kill>()  should return "
4850 "the error B<ESRCH>.  The glibc implementation returns this error in the "
4851 "cases where an invalid thread ID can be detected.  But note also that POSIX "
4852 "says that an attempt to use a thread ID whose lifetime has ended produces "
4853 "undefined behavior, and an attempt to use an invalid thread ID in a call to "
4854 "B<pthread_kill>()  can, for example, cause a segmentation fault."
4855 msgstr ""
4856
4857 #. type: Plain text
4858 #: build/C/man3/pthread_kill.3:107
4859 msgid ""
4860 "B<kill>(2), B<sigaction>(2), B<sigpending>(2), B<pthread_self>(3), "
4861 "B<pthread_sigmask>(3), B<raise>(3), B<pthreads>(7), B<signal>(7)"
4862 msgstr ""
4863
4864 #. type: TH
4865 #: build/C/man3/pthread_kill_other_threads_np.3:26
4866 #, no-wrap
4867 msgid "PTHREAD_KILL_OTHER_THREADS_NP"
4868 msgstr ""
4869
4870 #. type: Plain text
4871 #: build/C/man3/pthread_kill_other_threads_np.3:29
4872 msgid "pthread_kill_other_threads_np - terminate all other threads in process"
4873 msgstr ""
4874
4875 #. type: Plain text
4876 #: build/C/man3/pthread_kill_other_threads_np.3:34
4877 #, no-wrap
4878 msgid "B<void pthread_kill_other_threads_np(void);>\n"
4879 msgstr ""
4880
4881 #.  .SH VERSIONS
4882 #.  Available since glibc 2.0
4883 #. type: Plain text
4884 #: build/C/man3/pthread_kill_other_threads_np.3:47
4885 msgid ""
4886 "B<pthread_kill_other_threads_np>()  has an effect only in the LinuxThreads "
4887 "threading implementation.  On that implementation, calling this function "
4888 "causes the immediate termination of all threads in the application, except "
4889 "the calling thread.  The cancellation state and cancellation type of the "
4890 "to-be-terminated threads are ignored, and the cleanup handlers are not "
4891 "called in those threads."
4892 msgstr ""
4893
4894 #. type: Plain text
4895 #: build/C/man3/pthread_kill_other_threads_np.3:52
4896 msgid "The B<pthread_kill_other_threads_np>()  function is thread-safe."
4897 msgstr ""
4898
4899 #. type: Plain text
4900 #: build/C/man3/pthread_kill_other_threads_np.3:64
4901 msgid ""
4902 "B<pthread_kill_other_threads_np>()  is intended to be called just before a "
4903 "thread calls B<execve>(2)  or a similar function.  This function is designed "
4904 "to address a limitation in the obsolete LinuxThreads implementation whereby "
4905 "the other threads of an application are not automatically terminated (as "
4906 "POSIX.1-2001 requires) during B<execve>(2)."
4907 msgstr ""
4908
4909 #. type: Plain text
4910 #: build/C/man3/pthread_kill_other_threads_np.3:71
4911 msgid ""
4912 "In the NPTL threading implementation, B<pthread_kill_other_threads_np>()  "
4913 "exists, but does nothing.  (Nothing needs to be done, because the "
4914 "implementation does the right thing during an B<execve>(2).)"
4915 msgstr ""
4916
4917 #. type: Plain text
4918 #: build/C/man3/pthread_kill_other_threads_np.3:76
4919 msgid ""
4920 "B<execve>(2), B<pthread_cancel>(3), B<pthread_setcancelstate>(3), "
4921 "B<pthread_setcanceltype>(3), B<pthreads>(7)"
4922 msgstr ""
4923
4924 #. type: TH
4925 #: build/C/man3/pthread_rwlockattr_setkind_np.3:25
4926 #, no-wrap
4927 msgid "PTHREAD_RWLOCKATTR_SETKIND_NP"
4928 msgstr ""
4929
4930 #. type: TH
4931 #: build/C/man3/pthread_rwlockattr_setkind_np.3:25
4932 #, no-wrap
4933 msgid "2014-10-15"
4934 msgstr ""
4935
4936 #. type: Plain text
4937 #: build/C/man3/pthread_rwlockattr_setkind_np.3:29
4938 msgid ""
4939 "pthread_rwlockattr_setkind_np, pthread_rwlockattr_getkind_np - set/get the "
4940 "read-write lock kind of the thread read-write lock attribute object"
4941 msgstr ""
4942
4943 #. type: Plain text
4944 #: build/C/man3/pthread_rwlockattr_setkind_np.3:37
4945 #, no-wrap
4946 msgid ""
4947 "B<int pthread_rwlockattr_setkind_np(pthread_rwlockattr_t *>I<attr>B<,>\n"
4948 "B<                                   int >I<pref>B<);>\n"
4949 "B<int pthread_rwlockattr_getkind_np(const pthread_rwlockattr_t "
4950 "*>I<attr>B<,>\n"
4951 "B<                                   int *>I<pref>B<);>\n"
4952 msgstr ""
4953
4954 #. type: Plain text
4955 #: build/C/man3/pthread_rwlockattr_setkind_np.3:48
4956 msgid "B<pthread_rwlockattr_setkind_np>(), B<pthread_rwlockattr_getkind_np>():"
4957 msgstr ""
4958
4959 #. type: Plain text
4960 #: build/C/man3/pthread_rwlockattr_setkind_np.3:52
4961 msgid "_XOPEN_SOURCE\\ E<gt>=\\ 500 || _POSIX_C_SOURCE E<gt>= 200809L"
4962 msgstr ""
4963
4964 #. type: Plain text
4965 #: build/C/man3/pthread_rwlockattr_setkind_np.3:65
4966 msgid ""
4967 "The B<pthread_rwlockattr_setkind_np>()  function sets the \"lock kind\" "
4968 "attribute of the read-write lock attribute object referred to by I<attr> to "
4969 "the value specified in I<pref>.  The argument I<pref> may be set to one of "
4970 "the following:"
4971 msgstr ""
4972
4973 #. type: TP
4974 #: build/C/man3/pthread_rwlockattr_setkind_np.3:65
4975 #, no-wrap
4976 msgid "B<PTHREAD_RWLOCK_PREFER_READER_NP>"
4977 msgstr ""
4978
4979 #. type: Plain text
4980 #: build/C/man3/pthread_rwlockattr_setkind_np.3:78
4981 msgid ""
4982 "This is the default.  A thread may hold multiple read locks; that is, read "
4983 "locks are recursive.  According to The Single Unix Specification, the "
4984 "behavior is unspecified when a reader tries to place a lock, and there is no "
4985 "write lock but writers are waiting.  Giving preference to the reader, as is "
4986 "set by B<PTHREAD_RWLOCK_PREFER_READER_NP>, implies that the reader will "
4987 "receive the requested lock, even if a writer is waiting.  As long as there "
4988 "are readers, the writer will be starved."
4989 msgstr ""
4990
4991 #. type: TP
4992 #: build/C/man3/pthread_rwlockattr_setkind_np.3:78
4993 #, no-wrap
4994 msgid "B<PTHREAD_RWLOCK_PREFER_WRITER_NP>"
4995 msgstr ""
4996
4997 #. type: Plain text
4998 #: build/C/man3/pthread_rwlockattr_setkind_np.3:83
4999 msgid ""
5000 "This is intended as the write lock analog of "
5001 "B<PTHREAD_RWLOCK_PREFER_READER_NP>.  But see BUGS."
5002 msgstr ""
5003
5004 #. type: TP
5005 #: build/C/man3/pthread_rwlockattr_setkind_np.3:83
5006 #, no-wrap
5007 msgid "B<PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP>"
5008 msgstr ""
5009
5010 #. type: Plain text
5011 #: build/C/man3/pthread_rwlockattr_setkind_np.3:88
5012 msgid ""
5013 "Setting the lock kind to this avoids writer starvation as long as any read "
5014 "locking is not done in a recursive fashion."
5015 msgstr ""
5016
5017 #. type: Plain text
5018 #: build/C/man3/pthread_rwlockattr_setkind_np.3:96
5019 msgid ""
5020 "The B<pthread_rwlockattr_getkind_np>()  function returns the value of the "
5021 "lock kind attribute of the read-write lock attribute object referred to by "
5022 "I<attr> in the pointer I<pref>."
5023 msgstr ""
5024
5025 #. type: Plain text
5026 #: build/C/man3/pthread_rwlockattr_setkind_np.3:104
5027 msgid ""
5028 "On success, these functions return 0.  Given valid pointer arguments, "
5029 "B<pthread_rwlockattr_getkind_np>()  always succeeds.  On error, "
5030 "B<pthread_rwlockattr_setkind_np>()  returns a non-zero error number."
5031 msgstr ""
5032
5033 #. type: Plain text
5034 #: build/C/man3/pthread_rwlockattr_setkind_np.3:109
5035 msgid "I<pref> specifies an unsupported value."
5036 msgstr ""
5037
5038 #.  http://sourceware.org/bugzilla/show_bug.cgi?id=7057
5039 #. type: Plain text
5040 #: build/C/man3/pthread_rwlockattr_setkind_np.3:121
5041 msgid ""
5042 "Setting the value read-write lock kind to B<PTHREAD_RWLOCK_PREFER_WRITER_NP> "
5043 "results in the same behavior as setting the value to "
5044 "B<PTHREAD_RWLOCK_PREFER_READER_NP>.  As long as a reader thread holds the "
5045 "lock, the thread holding a write lock will be starved.  Setting the lock "
5046 "kind to B<PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP> allows writers to "
5047 "run, but, as the name implies a writer may not lock recursively."
5048 msgstr ""
5049
5050 #. type: Plain text
5051 #: build/C/man3/pthread_rwlockattr_setkind_np.3:127
5052 msgid ""
5053 "The B<pthread_rwlockattr_getkind_np>()  and "
5054 "B<pthread_rwlockattr_setkind_np>()  functions first appeared in glibc 2.1."
5055 msgstr ""
5056
5057 #. type: Plain text
5058 #: build/C/man3/pthread_rwlockattr_setkind_np.3:130
5059 msgid ""
5060 "These functions are non-standard GNU extensions; hence the suffix \"_np\" "
5061 "(non-portable) in the names."
5062 msgstr ""
5063
5064 #. type: Plain text
5065 #: build/C/man3/pthread_rwlockattr_setkind_np.3:131
5066 msgid "B<pthreads>(7)"
5067 msgstr ""
5068
5069 #. type: TH
5070 #: build/C/man3/pthread_self.3:26
5071 #, no-wrap
5072 msgid "PTHREAD_SELF"
5073 msgstr ""
5074
5075 #. type: Plain text
5076 #: build/C/man3/pthread_self.3:29
5077 msgid "pthread_self - obtain ID of the calling thread"
5078 msgstr ""
5079
5080 #. type: Plain text
5081 #: build/C/man3/pthread_self.3:34
5082 #, no-wrap
5083 msgid "B<pthread_t pthread_self(void);>\n"
5084 msgstr ""
5085
5086 #. type: Plain text
5087 #: build/C/man3/pthread_self.3:46
5088 msgid ""
5089 "The B<pthread_self>()  function returns the ID of the calling thread.  This "
5090 "is the same value that is returned in I<*thread> in the B<pthread_create>(3)  "
5091 "call that created this thread."
5092 msgstr ""
5093
5094 #. type: Plain text
5095 #: build/C/man3/pthread_self.3:48
5096 msgid "This function always succeeds, returning the calling thread's ID."
5097 msgstr ""
5098
5099 #. type: Plain text
5100 #: build/C/man3/pthread_self.3:55
5101 msgid "The B<pthread_self>()  function is thread-safe."
5102 msgstr ""
5103
5104 #. type: Plain text
5105 #: build/C/man3/pthread_self.3:68
5106 msgid ""
5107 "POSIX.1 allows an implementation wide freedom in choosing the type used to "
5108 "represent a thread ID; for example, representation using either an "
5109 "arithmetic type or a structure is permitted.  Therefore, variables of type "
5110 "I<pthread_t> can't portably be compared using the C equality operator "
5111 "(B<==>); use B<pthread_equal>(3)  instead."
5112 msgstr ""
5113
5114 #. type: Plain text
5115 #: build/C/man3/pthread_self.3:72
5116 msgid ""
5117 "Thread identifiers should be considered opaque: any attempt to use a thread "
5118 "ID other than in pthreads calls is nonportable and can lead to unspecified "
5119 "results."
5120 msgstr ""
5121
5122 #. type: Plain text
5123 #: build/C/man3/pthread_self.3:76
5124 msgid ""
5125 "Thread IDs are guaranteed to be unique only within a process.  A thread ID "
5126 "may be reused after a terminated thread has been joined, or a detached "
5127 "thread has terminated."
5128 msgstr ""
5129
5130 #. type: Plain text
5131 #: build/C/man3/pthread_self.3:81
5132 msgid ""
5133 "The thread ID returned by B<pthread_self>()  is not the same thing as the "
5134 "kernel thread ID returned by a call to B<gettid>(2)."
5135 msgstr ""
5136
5137 #. type: Plain text
5138 #: build/C/man3/pthread_self.3:84
5139 msgid "B<pthread_create>(3), B<pthread_equal>(3), B<pthreads>(7)"
5140 msgstr ""
5141
5142 #. type: TH
5143 #: build/C/man3/pthread_setaffinity_np.3:26
5144 #, no-wrap
5145 msgid "PTHREAD_SETAFFINITY_NP"
5146 msgstr ""
5147
5148 #. type: Plain text
5149 #: build/C/man3/pthread_setaffinity_np.3:30
5150 msgid ""
5151 "pthread_setaffinity_np, pthread_getaffinity_np - set/get CPU affinity of a "
5152 "thread"
5153 msgstr ""
5154
5155 #. type: Plain text
5156 #: build/C/man3/pthread_setaffinity_np.3:39
5157 #, no-wrap
5158 msgid ""
5159 "B<int pthread_setaffinity_np(pthread_t >I<thread>B<, size_t "
5160 ">I<cpusetsize>B<,>\n"
5161 "B<                           const cpu_set_t *>I<cpuset>B<);>\n"
5162 "B<int pthread_getaffinity_np(pthread_t >I<thread>B<, size_t "
5163 ">I<cpusetsize>B<,>\n"
5164 "B<                           cpu_set_t *>I<cpuset>B<);>\n"
5165 msgstr ""
5166
5167 #. type: Plain text
5168 #: build/C/man3/pthread_setaffinity_np.3:54
5169 msgid ""
5170 "The B<pthread_setaffinity_np>()  function sets the CPU affinity mask of the "
5171 "thread I<thread> to the CPU set pointed to by I<cpuset>.  If the call is "
5172 "successful, and the thread is not currently running on one of the CPUs in "
5173 "I<cpuset>, then it is migrated to one of those CPUs."
5174 msgstr ""
5175
5176 #. type: Plain text
5177 #: build/C/man3/pthread_setaffinity_np.3:61
5178 msgid ""
5179 "The B<pthread_getaffinity_np>()  function returns the CPU affinity mask of "
5180 "the thread I<thread> in the buffer pointed to by I<cpuset>."
5181 msgstr ""
5182
5183 #. type: Plain text
5184 #: build/C/man3/pthread_setaffinity_np.3:77
5185 msgid ""
5186 "The argument I<cpusetsize> is the length (in bytes) of the buffer pointed to "
5187 "by I<cpuset>.  Typically, this argument would be specified as "
5188 "I<sizeof(cpu_set_t)>.  (It may be some other value, if using the macros "
5189 "described in B<CPU_SET>(3)  for dynamically allocating a CPU set.)"
5190 msgstr ""
5191
5192 #. type: TP
5193 #: build/C/man3/pthread_setaffinity_np.3:81
5194 #, no-wrap
5195 msgid "B<EFAULT>"
5196 msgstr ""
5197
5198 #. type: Plain text
5199 #: build/C/man3/pthread_setaffinity_np.3:84
5200 msgid "A supplied memory address was invalid."
5201 msgstr ""
5202
5203 #. type: Plain text
5204 #: build/C/man3/pthread_setaffinity_np.3:93
5205 msgid ""
5206 "(B<pthread_setaffinity_np>())  The affinity bit mask I<mask> contains no "
5207 "processors that are currently physically on the system and permitted to the "
5208 "thread according to any restrictions that may be imposed by the \"cpuset\" "
5209 "mechanism described in B<cpuset>(7)."
5210 msgstr ""
5211
5212 #.  FIXME . ?
5213 #.  Loic Domaigne commented: it seems that in the future the
5214 #.  kernel developers want to make cpumask_t dynamic, so
5215 #.  CONFIG_NR_CPUS might become obsolete in the future.
5216 #.  cpumask_t
5217 #.  The raw sched_getaffinity() system call returns the size (in bytes)
5218 #.  of the cpumask_t type.
5219 #. type: Plain text
5220 #: build/C/man3/pthread_setaffinity_np.3:109
5221 msgid ""
5222 "(B<pthread_setaffinity_np>())  I<cpuset> specified a CPU that was outside "
5223 "the set supported by the kernel.  (The kernel configuration option "
5224 "B<CONFIG_NR_CPUS> defines the range of the set supported by the kernel data "
5225 "type used to represent CPU sets.)"
5226 msgstr ""
5227
5228 #. type: Plain text
5229 #: build/C/man3/pthread_setaffinity_np.3:114
5230 msgid ""
5231 "(B<pthread_getaffinity_np>())  I<cpusetsize> is smaller than the size of the "
5232 "affinity mask used by the kernel."
5233 msgstr ""
5234
5235 #. type: Plain text
5236 #: build/C/man3/pthread_setaffinity_np.3:128
5237 msgid ""
5238 "The B<pthread_setaffinity_np>()  and B<pthread_getaffinity_np>()  functions "
5239 "are thread-safe."
5240 msgstr ""
5241
5242 #. type: Plain text
5243 #: build/C/man3/pthread_setaffinity_np.3:144
5244 msgid ""
5245 "After a call to B<pthread_setaffinity_np>(), the set of CPUs on which the "
5246 "thread will actually run is the intersection of the set specified in the "
5247 "I<cpuset> argument and the set of CPUs actually present on the system.  The "
5248 "system may further restrict the set of CPUs on which the thread runs if the "
5249 "\"cpuset\" mechanism described in B<cpuset>(7)  is being used.  These "
5250 "restrictions on the actual set of CPUs on which the thread will run are "
5251 "silently imposed by the kernel."
5252 msgstr ""
5253
5254 #. type: Plain text
5255 #: build/C/man3/pthread_setaffinity_np.3:150
5256 msgid ""
5257 "These functions are implemented on top of the B<sched_setaffinity>(2)  and "
5258 "B<sched_getaffinity>(2)  system calls."
5259 msgstr ""
5260
5261 #. type: Plain text
5262 #: build/C/man3/pthread_setaffinity_np.3:161
5263 msgid ""
5264 "A new thread created by B<pthread_create>(3)  inherits a copy of its "
5265 "creator's CPU affinity mask."
5266 msgstr ""
5267
5268 #. type: Plain text
5269 #: build/C/man3/pthread_setaffinity_np.3:169
5270 msgid ""
5271 "In the following program, the main thread uses B<pthread_setaffinity_np>()  "
5272 "to set its CPU affinity mask to include CPUs 0 to 7 (which may not all be "
5273 "available on the system), and then calls B<pthread_getaffinity_np>()  to "
5274 "check the resulting CPU affinity mask of the thread."
5275 msgstr ""
5276
5277 #. type: Plain text
5278 #: build/C/man3/pthread_setaffinity_np.3:176
5279 #, no-wrap
5280 msgid ""
5281 "#define _GNU_SOURCE\n"
5282 "#include E<lt>pthread.hE<gt>\n"
5283 "#include E<lt>stdio.hE<gt>\n"
5284 "#include E<lt>stdlib.hE<gt>\n"
5285 "#include E<lt>errno.hE<gt>\n"
5286 msgstr ""
5287
5288 #. type: Plain text
5289 #: build/C/man3/pthread_setaffinity_np.3:186
5290 #, no-wrap
5291 msgid ""
5292 "int\n"
5293 "main(int argc, char *argv[])\n"
5294 "{\n"
5295 "    int s, j;\n"
5296 "    cpu_set_t cpuset;\n"
5297 "    pthread_t thread;\n"
5298 msgstr ""
5299
5300 #. type: Plain text
5301 #: build/C/man3/pthread_setaffinity_np.3:188
5302 #, no-wrap
5303 msgid "    thread = pthread_self();\n"
5304 msgstr ""
5305
5306 #. type: Plain text
5307 #: build/C/man3/pthread_setaffinity_np.3:190
5308 #, no-wrap
5309 msgid "    /* Set affinity mask to include CPUs 0 to 7 */\n"
5310 msgstr ""
5311
5312 #. type: Plain text
5313 #: build/C/man3/pthread_setaffinity_np.3:194
5314 #, no-wrap
5315 msgid ""
5316 "    CPU_ZERO(&cpuset);\n"
5317 "    for (j = 0; j E<lt> 8; j++)\n"
5318 "        CPU_SET(j, &cpuset);\n"
5319 msgstr ""
5320
5321 #. type: Plain text
5322 #: build/C/man3/pthread_setaffinity_np.3:198
5323 #, no-wrap
5324 msgid ""
5325 "    s = pthread_setaffinity_np(thread, sizeof(cpu_set_t), &cpuset);\n"
5326 "    if (s != 0)\n"
5327 "        handle_error_en(s, \"pthread_setaffinity_np\");\n"
5328 msgstr ""
5329
5330 #. type: Plain text
5331 #: build/C/man3/pthread_setaffinity_np.3:200
5332 #, no-wrap
5333 msgid "    /* Check the actual affinity mask assigned to the thread */\n"
5334 msgstr ""
5335
5336 #. type: Plain text
5337 #: build/C/man3/pthread_setaffinity_np.3:204
5338 #, no-wrap
5339 msgid ""
5340 "    s = pthread_getaffinity_np(thread, sizeof(cpu_set_t), &cpuset);\n"
5341 "    if (s != 0)\n"
5342 "        handle_error_en(s, \"pthread_getaffinity_np\");\n"
5343 msgstr ""
5344
5345 #. type: Plain text
5346 #: build/C/man3/pthread_setaffinity_np.3:209
5347 #, no-wrap
5348 msgid ""
5349 "    printf(\"Set returned by pthread_getaffinity_np() contained:\\en\");\n"
5350 "    for (j = 0; j E<lt> CPU_SETSIZE; j++)\n"
5351 "        if (CPU_ISSET(j, &cpuset))\n"
5352 "            printf(\"    CPU %d\\en\", j);\n"
5353 msgstr ""
5354
5355 #. type: Plain text
5356 #: build/C/man3/pthread_setaffinity_np.3:212 build/C/man3/pthread_setschedparam.3:439
5357 #, no-wrap
5358 msgid ""
5359 "    exit(EXIT_SUCCESS);\n"
5360 "}\n"
5361 msgstr ""
5362
5363 #. type: Plain text
5364 #: build/C/man3/pthread_setaffinity_np.3:220
5365 msgid ""
5366 "B<sched_setaffinity>(2), B<pthread_attr_setaffinity_np>(3), "
5367 "B<pthread_self>(3), B<sched_getcpu>(3), B<cpuset>(7), B<pthreads>(7), "
5368 "B<sched>(7)"
5369 msgstr ""
5370
5371 #. type: TH
5372 #: build/C/man3/pthread_setcancelstate.3:26
5373 #, no-wrap
5374 msgid "PTHREAD_SETCANCELSTATE"
5375 msgstr ""
5376
5377 #. type: Plain text
5378 #: build/C/man3/pthread_setcancelstate.3:30
5379 msgid ""
5380 "pthread_setcancelstate, pthread_setcanceltype - set cancelability state and "
5381 "type"
5382 msgstr ""
5383
5384 #. type: Plain text
5385 #: build/C/man3/pthread_setcancelstate.3:36
5386 #, no-wrap
5387 msgid ""
5388 "B<int pthread_setcancelstate(int >I<state>B<, int *>I<oldstate>B<);>\n"
5389 "B<int pthread_setcanceltype(int >I<type>B<, int *>I<oldtype>B<);>\n"
5390 msgstr ""
5391
5392 #. type: Plain text
5393 #: build/C/man3/pthread_setcancelstate.3:51
5394 msgid ""
5395 "The B<pthread_setcancelstate>()  sets the cancelability state of the calling "
5396 "thread to the value given in I<state>.  The previous cancelability state of "
5397 "the thread is returned in the buffer pointed to by I<oldstate>.  The "
5398 "I<state> argument must have one of the following values:"
5399 msgstr ""
5400
5401 #. type: TP
5402 #: build/C/man3/pthread_setcancelstate.3:51
5403 #, no-wrap
5404 msgid "B<PTHREAD_CANCEL_ENABLE>"
5405 msgstr ""
5406
5407 #. type: Plain text
5408 #: build/C/man3/pthread_setcancelstate.3:58
5409 msgid ""
5410 "The thread is cancelable.  This is the default cancelability state in all "
5411 "new threads, including the initial thread.  The thread's cancelability type "
5412 "determines when a cancelable thread will respond to a cancellation request."
5413 msgstr ""
5414
5415 #. type: TP
5416 #: build/C/man3/pthread_setcancelstate.3:58
5417 #, no-wrap
5418 msgid "B<PTHREAD_CANCEL_DISABLE>"
5419 msgstr ""
5420
5421 #. type: Plain text
5422 #: build/C/man3/pthread_setcancelstate.3:63
5423 msgid ""
5424 "The thread is not cancelable.  If a cancellation request is received, it is "
5425 "blocked until cancelability is enabled."
5426 msgstr ""
5427
5428 #. type: Plain text
5429 #: build/C/man3/pthread_setcancelstate.3:75
5430 msgid ""
5431 "The B<pthread_setcanceltype>()  sets the cancelability type of the calling "
5432 "thread to the value given in I<type>.  The previous cancelability type of "
5433 "the thread is returned in the buffer pointed to by I<oldtype>.  The I<type> "
5434 "argument must have one of the following values:"
5435 msgstr ""
5436
5437 #. type: TP
5438 #: build/C/man3/pthread_setcancelstate.3:75
5439 #, no-wrap
5440 msgid "B<PTHREAD_CANCEL_DEFERRED>"
5441 msgstr ""
5442
5443 #. type: Plain text
5444 #: build/C/man3/pthread_setcancelstate.3:82
5445 msgid ""
5446 "A cancellation request is deferred until the thread next calls a function "
5447 "that is a cancellation point (see B<pthreads>(7)).  This is the default "
5448 "cancelability type in all new threads, including the initial thread."
5449 msgstr ""
5450
5451 #. type: TP
5452 #: build/C/man3/pthread_setcancelstate.3:82
5453 #, no-wrap
5454 msgid "B<PTHREAD_CANCEL_ASYNCHRONOUS>"
5455 msgstr ""
5456
5457 #. type: Plain text
5458 #: build/C/man3/pthread_setcancelstate.3:88
5459 msgid ""
5460 "The thread can be canceled at any time.  (Typically, it will be canceled "
5461 "immediately upon receiving a cancellation request, but the system doesn't "
5462 "guarantee this.)"
5463 msgstr ""
5464
5465 #. type: Plain text
5466 #: build/C/man3/pthread_setcancelstate.3:92
5467 msgid ""
5468 "The set-and-get operation performed by each of these functions is atomic "
5469 "with respect to other threads in the process calling the same function."
5470 msgstr ""
5471
5472 #. type: Plain text
5473 #: build/C/man3/pthread_setcancelstate.3:99
5474 msgid "The B<pthread_setcancelstate>()  can fail with the following error:"
5475 msgstr ""
5476
5477 #. type: Plain text
5478 #: build/C/man3/pthread_setcancelstate.3:103
5479 msgid "Invalid value for I<state>."
5480 msgstr ""
5481
5482 #. type: Plain text
5483 #: build/C/man3/pthread_setcancelstate.3:107
5484 msgid "The B<pthread_setcanceltype>()  can fail with the following error:"
5485 msgstr ""
5486
5487 #.  .SH VERSIONS
5488 #.  Available since glibc 2.0
5489 #. type: Plain text
5490 #: build/C/man3/pthread_setcancelstate.3:113
5491 msgid "Invalid value for I<type>."
5492 msgstr ""
5493
5494 #. type: Plain text
5495 #: build/C/man3/pthread_setcancelstate.3:120
5496 msgid ""
5497 "The B<pthread_setcancelstate>()  and B<pthread_setcanceltype>()  functions "
5498 "are thread-safe."
5499 msgstr ""
5500
5501 #. type: Plain text
5502 #: build/C/man3/pthread_setcancelstate.3:125
5503 msgid ""
5504 "For details of what happens when a thread is canceled, see "
5505 "B<pthread_cancel>(3)."
5506 msgstr ""
5507
5508 #. type: Plain text
5509 #: build/C/man3/pthread_setcancelstate.3:132
5510 msgid ""
5511 "Briefly disabling cancelability is useful if a thread performs some critical "
5512 "action that must not be interrupted by a cancellation request.  Beware of "
5513 "disabling cancelability for long periods, or around operations that may "
5514 "block for long periods, since that will render the thread unresponsive to "
5515 "cancellation requests."
5516 msgstr ""
5517
5518 #. type: SS
5519 #: build/C/man3/pthread_setcancelstate.3:132
5520 #, no-wrap
5521 msgid "Asynchronous cancelability"
5522 msgstr ""
5523
5524 #. type: Plain text
5525 #: build/C/man3/pthread_setcancelstate.3:151
5526 msgid ""
5527 "Setting the cancelability type to B<PTHREAD_CANCEL_ASYNCHRONOUS> is rarely "
5528 "useful.  Since the thread could be canceled at I<any> time, it cannot safely "
5529 "reserve resources (e.g., allocating memory with B<malloc>(3)), acquire "
5530 "mutexes, semaphores, or locks, and so on.  Reserving resources is unsafe "
5531 "because the application has no way of knowing what the state of these "
5532 "resources is when the thread is canceled; that is, did cancellation occur "
5533 "before the resources were reserved, while they were reserved, or after they "
5534 "were released? Furthermore, some internal data structures (e.g., the linked "
5535 "list of free blocks managed by the B<malloc>(3)  family of functions) may be "
5536 "left in an inconsistent state if cancellation occurs in the middle of the "
5537 "function call.  Consequently, clean-up handlers cease to be useful."
5538 msgstr ""
5539
5540 #. type: Plain text
5541 #: build/C/man3/pthread_setcancelstate.3:162
5542 msgid ""
5543 "Functions that can be safely asynchronously canceled are called "
5544 "I<async-cancel-safe functions>.  POSIX.1-2001 requires only that "
5545 "B<pthread_cancel>(3), B<pthread_setcancelstate>(), and "
5546 "B<pthread_setcanceltype>()  be async-cancel-safe.  In general, other library "
5547 "functions can't be safely called from an asynchronously cancelable thread."
5548 msgstr ""
5549
5550 #. type: Plain text
5551 #: build/C/man3/pthread_setcancelstate.3:165
5552 msgid ""
5553 "One of the few circumstances in which asynchronous cancelability is useful "
5554 "is for cancellation of a thread that is in a pure compute-bound loop."
5555 msgstr ""
5556
5557 #. type: SS
5558 #: build/C/man3/pthread_setcancelstate.3:165
5559 #, no-wrap
5560 msgid "Portability notes"
5561 msgstr ""
5562
5563 #.  It looks like at least Solaris, FreeBSD and Tru64 support this.
5564 #. type: Plain text
5565 #: build/C/man3/pthread_setcancelstate.3:183
5566 msgid ""
5567 "The Linux threading implementations permit the I<oldstate> argument of "
5568 "B<pthread_setcancelstate>()  to be NULL, in which case the information about "
5569 "the previous cancelability state is not returned to the caller.  Many other "
5570 "implementations also permit a NULL I<oldstat> argument, but POSIX.1-2001 "
5571 "does not specify this point, so portable applications should always specify "
5572 "a non-NULL value in I<oldstate>.  A precisely analogous set of statements "
5573 "applies for the I<oldtype> argument of B<pthread_setcanceltype>()."
5574 msgstr ""
5575
5576 #. type: Plain text
5577 #: build/C/man3/pthread_setcancelstate.3:186
5578 msgid "See B<pthread_cancel>(3)."
5579 msgstr ""
5580
5581 #. type: Plain text
5582 #: build/C/man3/pthread_setcancelstate.3:190
5583 msgid ""
5584 "B<pthread_cancel>(3), B<pthread_cleanup_push>(3), B<pthread_testcancel>(3), "
5585 "B<pthreads>(7)"
5586 msgstr ""
5587
5588 #. type: TH
5589 #: build/C/man3/pthread_setconcurrency.3:25
5590 #, no-wrap
5591 msgid "PTHREAD_SETCONCURRENCY"
5592 msgstr ""
5593
5594 #. type: Plain text
5595 #: build/C/man3/pthread_setconcurrency.3:29
5596 msgid ""
5597 "pthread_setconcurrency, pthread_getconcurrency - set/get the concurrency "
5598 "level"
5599 msgstr ""
5600
5601 #. type: Plain text
5602 #: build/C/man3/pthread_setconcurrency.3:35
5603 #, no-wrap
5604 msgid ""
5605 "B<int pthread_setconcurrency(int >I<new_level>B<);>\n"
5606 "B<int pthread_getconcurrency(void);>\n"
5607 msgstr ""
5608
5609 #. type: Plain text
5610 #: build/C/man3/pthread_setconcurrency.3:48
5611 msgid ""
5612 "The B<pthread_setconcurrency>()  function informs the implementation of the "
5613 "application's desired concurrency level, specified in I<new_level>.  The "
5614 "implementation takes this only as a hint: POSIX.1 does not specify the level "
5615 "of concurrency that should be provided as a result of calling "
5616 "B<pthread_setconcurrency>()."
5617 msgstr ""
5618
5619 #. type: Plain text
5620 #: build/C/man3/pthread_setconcurrency.3:53
5621 msgid ""
5622 "Specifying I<new_level> as 0 instructs the implementation to manage the "
5623 "concurrency level as it deems appropriate."
5624 msgstr ""
5625
5626 #. type: Plain text
5627 #: build/C/man3/pthread_setconcurrency.3:56
5628 msgid ""
5629 "B<pthread_getconcurrency>()  returns the current value of the concurrency "
5630 "level for this process."
5631 msgstr ""
5632
5633 #. type: Plain text
5634 #: build/C/man3/pthread_setconcurrency.3:61
5635 msgid ""
5636 "On success, B<pthread_setconcurrency>()  returns 0; on error, it returns a "
5637 "nonzero error number."
5638 msgstr ""
5639
5640 #. type: Plain text
5641 #: build/C/man3/pthread_setconcurrency.3:68
5642 msgid ""
5643 "B<pthread_getconcurrency>()  always succeeds, returning the concurrency "
5644 "level set by a previous call to B<pthread_setconcurrency>(), or 0, if "
5645 "B<pthread_setconcurrency>()  has not previously been called."
5646 msgstr ""
5647
5648 #. type: Plain text
5649 #: build/C/man3/pthread_setconcurrency.3:71
5650 msgid "B<pthread_setconcurrency>()  can fail with the following error:"
5651 msgstr ""
5652
5653 #. type: Plain text
5654 #: build/C/man3/pthread_setconcurrency.3:75
5655 msgid "I<new_level> is negative."
5656 msgstr ""
5657
5658 #. type: Plain text
5659 #: build/C/man3/pthread_setconcurrency.3:81
5660 msgid ""
5661 "POSIX.1-2001 also documents an B<EAGAIN> error (\"the value specified by "
5662 "I<new_level> would cause a system resource to be exceeded\")."
5663 msgstr ""
5664
5665 #. type: Plain text
5666 #: build/C/man3/pthread_setconcurrency.3:83
5667 msgid "These functions are available in glibc since version 2.1."
5668 msgstr ""
5669
5670 #. type: Plain text
5671 #: build/C/man3/pthread_setconcurrency.3:90
5672 msgid ""
5673 "The B<pthread_setconcurrency>()  and B<pthread_getconcurrency>()  functions "
5674 "are thread-safe."
5675 msgstr ""
5676
5677 #. type: Plain text
5678 #: build/C/man3/pthread_setconcurrency.3:94
5679 msgid "The default concurrency level is 0."
5680 msgstr ""
5681
5682 #. type: Plain text
5683 #: build/C/man3/pthread_setconcurrency.3:101
5684 msgid ""
5685 "Concurrency levels are meaningful only for M:N threading implementations, "
5686 "where at any moment a subset of a process's set of user-level threads may be "
5687 "bound to a smaller number of kernel-scheduling entities.  Setting the "
5688 "concurrency level allows the application to give the system a hint as to the "
5689 "number of kernel-scheduling entities that should be provided for efficient "
5690 "execution of the application."
5691 msgstr ""
5692
5693 #. type: Plain text
5694 #: build/C/man3/pthread_setconcurrency.3:107
5695 msgid ""
5696 "Both LinuxThreads and NPTL are 1:1 threading implementations, so setting the "
5697 "concurrency level has no meaning.  In other words, on Linux these functions "
5698 "merely exist for compatibility with other systems, and they have no effect "
5699 "on the execution of a program."
5700 msgstr ""
5701
5702 #. type: Plain text
5703 #: build/C/man3/pthread_setconcurrency.3:109
5704 msgid "B<pthread_attr_setscope>(3), B<pthreads>(7)"
5705 msgstr ""
5706
5707 #. type: TH
5708 #: build/C/man3/pthread_setname_np.3:26
5709 #, no-wrap
5710 msgid "PTHREAD_SETNAME_NP"
5711 msgstr ""
5712
5713 #. type: Plain text
5714 #: build/C/man3/pthread_setname_np.3:29
5715 msgid "pthread_setname_np, pthread_getname_np - set/get the name of a thread"
5716 msgstr ""
5717
5718 #. type: Plain text
5719 #: build/C/man3/pthread_setname_np.3:36
5720 #, no-wrap
5721 msgid ""
5722 "B<#define _GNU_SOURCE>             /* See feature_test_macros(7) */\n"
5723 "B<#include E<lt>pthread.hE<gt>>\n"
5724 "B<int pthread_setname_np(pthread_t >I<thread>B<, const char *>I<name>B<);>\n"
5725 "B<int pthread_getname_np(pthread_t >I<thread>B<,>\n"
5726 "B<                       char *>I<name>B<, size_t >I<len>B<);>\n"
5727 msgstr ""
5728
5729 #. type: Plain text
5730 #: build/C/man3/pthread_setname_np.3:55
5731 msgid ""
5732 "By default, all the threads created using B<pthread_create>()  inherit the "
5733 "program name.  The B<pthread_setname_np>()  function can be used to set a "
5734 "unique name for a thread, which can be useful for debugging multithreaded "
5735 "applications.  The thread name is a meaningful C language string, whose "
5736 "length is restricted to 16 characters, including the terminating null byte "
5737 "(\\(aq\\e0\\(aq).  The I<thread> argument specifies the thread whose name is "
5738 "to be changed; I<name> specifies the new name."
5739 msgstr ""
5740
5741 #. type: Plain text
5742 #: build/C/man3/pthread_setname_np.3:72
5743 msgid ""
5744 "The B<pthread_getname_np>()  function can be used to retrieve the name of "
5745 "the thread.  The I<thread> argument specifies the thread whose name is to be "
5746 "retrieved.  The buffer I<name> is used to return the thread name; I<len> "
5747 "specifies the number of bytes available in I<name>.  The buffer specified by "
5748 "I<name> should be at least 16 characters in length.  The returned thread "
5749 "name in the output buffer will be null terminated."
5750 msgstr ""
5751
5752 #. type: Plain text
5753 #: build/C/man3/pthread_setname_np.3:79
5754 msgid "The B<pthread_setname_np>()  function can fail with the following error:"
5755 msgstr ""
5756
5757 #. type: TP
5758 #: build/C/man3/pthread_setname_np.3:79 build/C/man3/pthread_setname_np.3:88
5759 #, no-wrap
5760 msgid "B<ERANGE>"
5761 msgstr ""
5762
5763 #. type: Plain text
5764 #: build/C/man3/pthread_setname_np.3:84
5765 msgid ""
5766 "The length of the string specified pointed to by I<name> exceeds the allowed "
5767 "limit."
5768 msgstr ""
5769
5770 #. type: Plain text
5771 #: build/C/man3/pthread_setname_np.3:88
5772 msgid "The B<pthread_getname_np>()  function can fail with the following error:"
5773 msgstr ""
5774
5775 #. type: Plain text
5776 #: build/C/man3/pthread_setname_np.3:95
5777 msgid ""
5778 "The buffer specified by I<name> and I<len> is too small to hold the thread "
5779 "name."
5780 msgstr ""
5781
5782 #. type: Plain text
5783 #: build/C/man3/pthread_setname_np.3:100
5784 msgid ""
5785 "If either of these functions fails to open I</proc/self/task/[tid]/comm>, "
5786 "then the call may fail with one of the errors described in B<open>(2)."
5787 msgstr ""
5788
5789 #. type: Plain text
5790 #: build/C/man3/pthread_setname_np.3:102
5791 msgid "These functions first appeared in glibc in version 2.12."
5792 msgstr ""
5793
5794 #. type: Plain text
5795 #: build/C/man3/pthread_setname_np.3:104
5796 msgid "These functions are nonstandard GNU extensions."
5797 msgstr ""
5798
5799 #. type: Plain text
5800 #: build/C/man3/pthread_setname_np.3:114
5801 msgid ""
5802 "B<pthread_setname_np>()  internally writes to the thread-specific I<comm> "
5803 "file under the I</proc> filesystem: I</proc/self/task/[tid]/comm>.  "
5804 "B<pthread_getname_np>()  retrieves it from the same location."
5805 msgstr ""
5806
5807 #. type: Plain text
5808 #: build/C/man3/pthread_setname_np.3:120
5809 msgid ""
5810 "The program below demonstrates the use of B<pthread_setname_np>()  and "
5811 "B<pthread_getname_np>()."
5812 msgstr ""
5813
5814 #. type: Plain text
5815 #: build/C/man3/pthread_setname_np.3:122
5816 msgid "The following shell session shows a sample run of the program:"
5817 msgstr ""
5818
5819 #. type: Plain text
5820 #: build/C/man3/pthread_setname_np.3:138
5821 #, no-wrap
5822 msgid ""
5823 "$B< ./a.out>\n"
5824 "Created a thread. Default name is: a.out\n"
5825 "The thread name after setting it is THREADFOO.\n"
5826 "B<^Z>                           # Suspend the program\n"
5827 "[1]+  Stopped           ./a.out\n"
5828 "$ B<ps H -C a.out -o 'pid tid cmd comm'>\n"
5829 "  PID   TID CMD                         COMMAND\n"
5830 " 5990  5990 ./a.out                     a.out\n"
5831 " 5990  5991 ./a.out                     THREADFOO\n"
5832 "$ B<cat /proc/5990/task/5990/comm>\n"
5833 "a.out\n"
5834 "$ B<cat /proc/5990/task/5991/comm>\n"
5835 "THREADFOO\n"
5836 msgstr ""
5837
5838 #. type: Plain text
5839 #: build/C/man3/pthread_setname_np.3:150
5840 #, no-wrap
5841 msgid ""
5842 "#define _GNU_SOURCE\n"
5843 "#include E<lt>pthread.hE<gt>\n"
5844 "#include E<lt>stdio.hE<gt>\n"
5845 "#include E<lt>string.hE<gt>\n"
5846 "#include E<lt>unistd.hE<gt>\n"
5847 "#include E<lt>errno.hE<gt>\n"
5848 "#include E<lt>stdlib.hE<gt>\n"
5849 msgstr ""
5850
5851 #. type: Plain text
5852 #: build/C/man3/pthread_setname_np.3:152
5853 #, no-wrap
5854 msgid "#define NAMELEN 16\n"
5855 msgstr ""
5856
5857 #. type: Plain text
5858 #: build/C/man3/pthread_setname_np.3:156
5859 #, no-wrap
5860 msgid ""
5861 "#define errExitEN(en, msg) \\e\n"
5862 "            do { errno = en; perror(msg); exit(EXIT_FAILURE); \\e\n"
5863 "        } while (0)\n"
5864 msgstr ""
5865
5866 #. type: Plain text
5867 #: build/C/man3/pthread_setname_np.3:163
5868 #, no-wrap
5869 msgid ""
5870 "static void *\n"
5871 "threadfunc(void *parm)\n"
5872 "{\n"
5873 "    sleep(5);          // allow main program to set the thread name\n"
5874 "    return NULL;\n"
5875 "}\n"
5876 msgstr ""
5877
5878 #. type: Plain text
5879 #: build/C/man3/pthread_setname_np.3:170
5880 #, no-wrap
5881 msgid ""
5882 "int\n"
5883 "main(int argc, char **argv)\n"
5884 "{\n"
5885 "    pthread_t thread;\n"
5886 "    int rc;\n"
5887 "    char thread_name[NAMELEN];\n"
5888 msgstr ""
5889
5890 #. type: Plain text
5891 #: build/C/man3/pthread_setname_np.3:174
5892 #, no-wrap
5893 msgid ""
5894 "    rc = pthread_create(&thread, NULL, threadfunc, NULL);\n"
5895 "    if (rc != 0)\n"
5896 "        errExitEN(rc, \"pthread_create\");\n"
5897 msgstr ""
5898
5899 #. type: Plain text
5900 #: build/C/man3/pthread_setname_np.3:178
5901 #, no-wrap
5902 msgid ""
5903 "    rc = pthread_getname_np(thread, thread_name, NAMELEN);\n"
5904 "    if (rc != 0)\n"
5905 "        errExitEN(rc, \"pthread_getname_np\");\n"
5906 msgstr ""
5907
5908 #. type: Plain text
5909 #: build/C/man3/pthread_setname_np.3:183
5910 #, no-wrap
5911 msgid ""
5912 "    printf(\"Created a thread. Default name is: %s\\en\", thread_name);\n"
5913 "    rc = pthread_setname_np(thread, (argc E<gt> 1) ? argv[1] : "
5914 "\"THREADFOO\");\n"
5915 "    if (rc != 0)\n"
5916 "        errExitEN(rc, \"pthread_setname_np\");\n"
5917 msgstr ""
5918
5919 #. type: Plain text
5920 #: build/C/man3/pthread_setname_np.3:185
5921 #, no-wrap
5922 msgid "    sleep(2);\n"
5923 msgstr ""
5924
5925 #. type: Plain text
5926 #: build/C/man3/pthread_setname_np.3:191
5927 #, no-wrap
5928 msgid ""
5929 "    rc = pthread_getname_np(thread, thread_name,\n"
5930 "                            (argc E<gt> 2) ? atoi(argv[1]) : NAMELEN);\n"
5931 "    if (rc != 0)\n"
5932 "        errExitEN(rc, \"pthread_getname_np\");\n"
5933 "    printf(\"The thread name after setting it is %s.\\en\", thread_name);\n"
5934 msgstr ""
5935
5936 #. type: Plain text
5937 #: build/C/man3/pthread_setname_np.3:195
5938 #, no-wrap
5939 msgid ""
5940 "    rc = pthread_join(thread, NULL);\n"
5941 "    if (rc != 0)\n"
5942 "        errExitEN(rc, \"pthread_join\");\n"
5943 msgstr ""
5944
5945 #. type: Plain text
5946 #: build/C/man3/pthread_setname_np.3:199
5947 #, no-wrap
5948 msgid ""
5949 "    printf(\"Done\\en\");\n"
5950 "    exit(EXIT_SUCCESS);\n"
5951 "}\n"
5952 msgstr ""
5953
5954 #. type: Plain text
5955 #: build/C/man3/pthread_setname_np.3:205
5956 msgid "B<prctl>(2), B<pthread_create>(3), B<pthreads>(7)"
5957 msgstr ""
5958
5959 #. type: TH
5960 #: build/C/man3/pthread_setschedparam.3:26
5961 #, no-wrap
5962 msgid "PTHREAD_SETSCHEDPARAM"
5963 msgstr ""
5964
5965 #. type: TH
5966 #: build/C/man3/pthread_setschedparam.3:26
5967 #, no-wrap
5968 msgid "2014-12-31"
5969 msgstr ""
5970
5971 #. type: Plain text
5972 #: build/C/man3/pthread_setschedparam.3:30
5973 msgid ""
5974 "pthread_setschedparam, pthread_getschedparam - set/get scheduling policy and "
5975 "parameters of a thread"
5976 msgstr ""
5977
5978 #. type: Plain text
5979 #: build/C/man3/pthread_setschedparam.3:38
5980 #, no-wrap
5981 msgid ""
5982 "B<int pthread_setschedparam(pthread_t >I<thread>B<, int >I<policy>B<,>\n"
5983 "B<                          const struct sched_param *>I<param>B<);>\n"
5984 "B<int pthread_getschedparam(pthread_t >I<thread>B<, int *>I<policy>B<,>\n"
5985 "B<                          struct sched_param *>I<param>B<);>\n"
5986 msgstr ""
5987
5988 #. type: Plain text
5989 #: build/C/man3/pthread_setschedparam.3:46
5990 msgid ""
5991 "The B<pthread_setschedparam>()  function sets the scheduling policy and "
5992 "parameters of the thread I<thread>."
5993 msgstr ""
5994
5995 #.  FIXME . pthread_setschedparam() places no restriction on the policy,
5996 #.  but pthread_attr_setschedpolicy() restricts policy to RR/FIFO/OTHER
5997 #.  http://sourceware.org/bugzilla/show_bug.cgi?id=7013
5998 #. type: Plain text
5999 #: build/C/man3/pthread_setschedparam.3:57
6000 msgid ""
6001 "I<policy> specifies the new scheduling policy for I<thread>.  The supported "
6002 "values for I<policy>, and their semantics, are described in B<sched>(7)."
6003 msgstr ""
6004
6005 #. type: Plain text
6006 #: build/C/man3/pthread_setschedparam.3:63
6007 msgid ""
6008 "The structure pointed to by I<param> specifies the new scheduling parameters "
6009 "for I<thread>.  Scheduling parameters are maintained in the following "
6010 "structure:"
6011 msgstr ""
6012
6013 #.  FIXME . nptl/pthread_setschedparam.c has the following
6014 #.    /* If the thread should have higher priority because of some
6015 #.       PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */
6016 #.  Eventually (perhaps after writing the mutexattr pages), we
6017 #.  may want to add something on the topic to this page.
6018 #. type: Plain text
6019 #: build/C/man3/pthread_setschedparam.3:104
6020 msgid ""
6021 "The B<pthread_getschedparam>()  function returns the scheduling policy and "
6022 "parameters of the thread I<thread>, in the buffers pointed to by I<policy> "
6023 "and I<param>, respectively.  The returned priority value is that set by the "
6024 "most recent B<pthread_setschedparam>(), B<pthread_setschedprio>(3), or "
6025 "B<pthread_create>(3)  call that affected I<thread>.  The returned priority "
6026 "does not reflect any temporary priority adjustments as a result of calls to "
6027 "any priority inheritance or priority ceiling functions (see, for example, "
6028 "B<pthread_mutexattr_setprioceiling>(3)  and "
6029 "B<pthread_mutexattr_setprotocol>(3))."
6030 msgstr ""
6031
6032 #. type: Plain text
6033 #: build/C/man3/pthread_setschedparam.3:112
6034 msgid ""
6035 "On success, these functions return 0; on error, they return a nonzero error "
6036 "number.  If B<pthread_setschedparam>()  fails, the scheduling policy and "
6037 "parameters of I<thread> are not changed."
6038 msgstr ""
6039
6040 #. type: Plain text
6041 #: build/C/man3/pthread_setschedparam.3:114
6042 msgid "Both of these functions can fail with the following error:"
6043 msgstr ""
6044
6045 #. type: Plain text
6046 #: build/C/man3/pthread_setschedparam.3:122
6047 msgid "B<pthread_setschedparam>()  may additionally fail with the following errors:"
6048 msgstr ""
6049
6050 #. type: Plain text
6051 #: build/C/man3/pthread_setschedparam.3:129
6052 msgid ""
6053 "I<policy> is not a recognized policy, or I<param> does not make sense for "
6054 "the I<policy>."
6055 msgstr ""
6056
6057 #. type: Plain text
6058 #: build/C/man3/pthread_setschedparam.3:133
6059 msgid ""
6060 "The caller does not have appropriate privileges to set the specified "
6061 "scheduling policy and parameters."
6062 msgstr ""
6063
6064 #.  .SH VERSIONS
6065 #.  Available since glibc 2.0
6066 #. type: Plain text
6067 #: build/C/man3/pthread_setschedparam.3:141
6068 msgid ""
6069 "POSIX.1-2001 also documents an B<ENOTSUP> (\"attempt was made to set the "
6070 "policy or scheduling parameters to an unsupported value\") error for "
6071 "B<pthread_setschedparam>()."
6072 msgstr ""
6073
6074 #. type: Plain text
6075 #: build/C/man3/pthread_setschedparam.3:148
6076 msgid ""
6077 "The B<pthread_setschedparam>()  and B<pthread_getschedparam>()  functions "
6078 "are thread-safe."
6079 msgstr ""
6080
6081 #. type: Plain text
6082 #: build/C/man3/pthread_setschedparam.3:156
6083 msgid ""
6084 "For a description of the permissions required to, and the effect of, "
6085 "changing a thread's scheduling policy and priority, and details of the "
6086 "permitted ranges for priorities in each scheduling policy, see B<sched>(7)."
6087 msgstr ""
6088
6089 #. type: Plain text
6090 #: build/C/man3/pthread_setschedparam.3:163
6091 msgid ""
6092 "The program below demonstrates the use of B<pthread_setschedparam>()  and "
6093 "B<pthread_getschedparam>(), as well as the use of a number of other "
6094 "scheduling-related pthreads functions."
6095 msgstr ""
6096
6097 #. type: Plain text
6098 #: build/C/man3/pthread_setschedparam.3:179
6099 msgid ""
6100 "In the following run, the main thread sets its scheduling policy to "
6101 "B<SCHED_FIFO> with a priority of 10, and initializes a thread attributes "
6102 "object with a scheduling policy attribute of B<SCHED_RR> and a scheduling "
6103 "priority attribute of 20.  The program then sets (using "
6104 "B<pthread_attr_setinheritsched>(3))  the inherit scheduler attribute of the "
6105 "thread attributes object to B<PTHREAD_EXPLICIT_SCHED>, meaning that threads "
6106 "created using this attributes object should take their scheduling attributes "
6107 "from the thread attributes object.  The program then creates a thread using "
6108 "the thread attributes object, and that thread displays its scheduling policy "
6109 "and priority."
6110 msgstr ""
6111
6112 #. type: Plain text
6113 #: build/C/man3/pthread_setschedparam.3:187
6114 #, no-wrap
6115 msgid ""
6116 "$ B<su>      # Need privilege to set real-time scheduling policies\n"
6117 "Password:\n"
6118 "# B<./a.out -mf10 -ar20 -i e>\n"
6119 "Scheduler settings of main thread\n"
6120 "    policy=SCHED_FIFO, priority=10\n"
6121 msgstr ""
6122
6123 #. type: Plain text
6124 #: build/C/man3/pthread_setschedparam.3:191
6125 #, no-wrap
6126 msgid ""
6127 "Scheduler settings in \\(aqattr\\(aq\n"
6128 "    policy=SCHED_RR, priority=20\n"
6129 "    inheritsched is EXPLICIT\n"
6130 msgstr ""
6131
6132 #. type: Plain text
6133 #: build/C/man3/pthread_setschedparam.3:194
6134 #, no-wrap
6135 msgid ""
6136 "Scheduler attributes of new thread\n"
6137 "    policy=SCHED_RR, priority=20\n"
6138 msgstr ""
6139
6140 #. type: Plain text
6141 #: build/C/man3/pthread_setschedparam.3:199
6142 msgid ""
6143 "In the above output, one can see that the scheduling policy and priority "
6144 "were taken from the values specified in the thread attributes object."
6145 msgstr ""
6146
6147 #. type: Plain text
6148 #: build/C/man3/pthread_setschedparam.3:206
6149 msgid ""
6150 "The next run is the same as the previous, except that the inherit scheduler "
6151 "attribute is set to B<PTHREAD_INHERIT_SCHED>, meaning that threads created "
6152 "using the thread attributes object should ignore the scheduling attributes "
6153 "specified in the attributes object and instead take their scheduling "
6154 "attributes from the creating thread."
6155 msgstr ""
6156
6157 #. type: Plain text
6158 #: build/C/man3/pthread_setschedparam.3:212
6159 #, no-wrap
6160 msgid ""
6161 "# B<./a.out -mf10 -ar20 -i i>\n"
6162 "Scheduler settings of main thread\n"
6163 "    policy=SCHED_FIFO, priority=10\n"
6164 msgstr ""
6165
6166 #. type: Plain text
6167 #: build/C/man3/pthread_setschedparam.3:216
6168 #, no-wrap
6169 msgid ""
6170 "Scheduler settings in \\(aqattr\\(aq\n"
6171 "    policy=SCHED_RR, priority=20\n"
6172 "    inheritsched is INHERIT\n"
6173 msgstr ""
6174
6175 #. type: Plain text
6176 #: build/C/man3/pthread_setschedparam.3:219
6177 #, no-wrap
6178 msgid ""
6179 "Scheduler attributes of new thread\n"
6180 "    policy=SCHED_FIFO, priority=10\n"
6181 msgstr ""
6182
6183 #. type: Plain text
6184 #: build/C/man3/pthread_setschedparam.3:225
6185 msgid ""
6186 "In the above output, one can see that the scheduling policy and priority "
6187 "were taken from the creating thread, rather than the thread attributes "
6188 "object."
6189 msgstr ""
6190
6191 #. type: Plain text
6192 #: build/C/man3/pthread_setschedparam.3:231
6193 msgid ""
6194 "Note that if we had omitted the I<-i\\ i> option, the output would have been "
6195 "the same, since B<PTHREAD_INHERIT_SCHED> is the default for the inherit "
6196 "scheduler attribute."
6197 msgstr ""
6198
6199 #. type: Plain text
6200 #: build/C/man3/pthread_setschedparam.3:235
6201 #, no-wrap
6202 msgid "/* pthreads_sched_test.c */\n"
6203 msgstr ""
6204
6205 #. type: Plain text
6206 #: build/C/man3/pthread_setschedparam.3:241
6207 #, no-wrap
6208 msgid ""
6209 "#include E<lt>pthread.hE<gt>\n"
6210 "#include E<lt>stdio.hE<gt>\n"
6211 "#include E<lt>stdlib.hE<gt>\n"
6212 "#include E<lt>unistd.hE<gt>\n"
6213 "#include E<lt>errno.hE<gt>\n"
6214 msgstr ""
6215
6216 #. type: Plain text
6217 #: build/C/man3/pthread_setschedparam.3:250
6218 #, no-wrap
6219 msgid ""
6220 "static void\n"
6221 "usage(char *prog_name, char *msg)\n"
6222 "{\n"
6223 "    if (msg != NULL)\n"
6224 "        fputs(msg, stderr);\n"
6225 msgstr ""
6226
6227 #. type: Plain text
6228 #: build/C/man3/pthread_setschedparam.3:267
6229 #, no-wrap
6230 msgid ""
6231 "    fprintf(stderr, \"Usage: %s [options]\\en\", prog_name);\n"
6232 "    fprintf(stderr, \"Options are:\\en\");\n"
6233 "#define fpe(msg) fprintf(stderr, \"\\et%s\", msg);          /* Shorter */\n"
6234 "    fpe(\"-aE<lt>policyE<gt>E<lt>prioE<gt> Set scheduling policy and "
6235 "priority in\\en\");\n"
6236 "    fpe(\"                 thread attributes object\\en\");\n"
6237 "    fpe(\"                 E<lt>policyE<gt> can be\\en\");\n"
6238 "    fpe(\"                     f  SCHED_FIFO\\en\");\n"
6239 "    fpe(\"                     r  SCHED_RR\\en\");\n"
6240 "    fpe(\"                     o  SCHED_OTHER\\en\");\n"
6241 "    fpe(\"-A               Use default thread attributes object\\en\");\n"
6242 "    fpe(\"-i {e|i}         Set inherit scheduler attribute to\\en\");\n"
6243 "    fpe(\"                 \\(aqexplicit\\(aq or \\(aqinherit\\(aq\\en\");\n"
6244 "    fpe(\"-mE<lt>policyE<gt>E<lt>prioE<gt> Set scheduling policy and "
6245 "priority on\\en\");\n"
6246 "    fpe(\"                 main thread before pthread_create() "
6247 "call\\en\");\n"
6248 "    exit(EXIT_FAILURE);\n"
6249 "}\n"
6250 msgstr ""
6251
6252 #. type: Plain text
6253 #: build/C/man3/pthread_setschedparam.3:278
6254 #, no-wrap
6255 msgid ""
6256 "static int\n"
6257 "get_policy(char p, int *policy)\n"
6258 "{\n"
6259 "    switch (p) {\n"
6260 "    case \\(aqf\\(aq: *policy = SCHED_FIFO;     return 1;\n"
6261 "    case \\(aqr\\(aq: *policy = SCHED_RR;       return 1;\n"
6262 "    case \\(aqo\\(aq: *policy = SCHED_OTHER;    return 1;\n"
6263 "    default:  return 0;\n"
6264 "    }\n"
6265 "}\n"
6266 msgstr ""
6267
6268 #. type: Plain text
6269 #: build/C/man3/pthread_setschedparam.3:289
6270 #, no-wrap
6271 msgid ""
6272 "static void\n"
6273 "display_sched_attr(int policy, struct sched_param *param)\n"
6274 "{\n"
6275 "    printf(\"    policy=%s, priority=%d\\en\",\n"
6276 "            (policy == SCHED_FIFO)  ? \"SCHED_FIFO\" :\n"
6277 "            (policy == SCHED_RR)    ? \"SCHED_RR\" :\n"
6278 "            (policy == SCHED_OTHER) ? \"SCHED_OTHER\" :\n"
6279 "            \"???\",\n"
6280 "            param-E<gt>sched_priority);\n"
6281 "}\n"
6282 msgstr ""
6283
6284 #. type: Plain text
6285 #: build/C/man3/pthread_setschedparam.3:295
6286 #, no-wrap
6287 msgid ""
6288 "static void\n"
6289 "display_thread_sched_attr(char *msg)\n"
6290 "{\n"
6291 "    int policy, s;\n"
6292 "    struct sched_param param;\n"
6293 msgstr ""
6294
6295 #. type: Plain text
6296 #: build/C/man3/pthread_setschedparam.3:299
6297 #, no-wrap
6298 msgid ""
6299 "    s = pthread_getschedparam(pthread_self(), &policy, &param);\n"
6300 "    if (s != 0)\n"
6301 "        handle_error_en(s, \"pthread_getschedparam\");\n"
6302 msgstr ""
6303
6304 #. type: Plain text
6305 #: build/C/man3/pthread_setschedparam.3:303
6306 #, no-wrap
6307 msgid ""
6308 "    printf(\"%s\\en\", msg);\n"
6309 "    display_sched_attr(policy, &param);\n"
6310 "}\n"
6311 msgstr ""
6312
6313 #. type: Plain text
6314 #: build/C/man3/pthread_setschedparam.3:308
6315 #, no-wrap
6316 msgid ""
6317 "static void *\n"
6318 "thread_start(void *arg)\n"
6319 "{\n"
6320 "    display_thread_sched_attr(\"Scheduler attributes of new thread\");\n"
6321 msgstr ""
6322
6323 #. type: Plain text
6324 #: build/C/man3/pthread_setschedparam.3:311
6325 #, no-wrap
6326 msgid ""
6327 "    return NULL;\n"
6328 "}\n"
6329 msgstr ""
6330
6331 #. type: Plain text
6332 #: build/C/man3/pthread_setschedparam.3:321
6333 #, no-wrap
6334 msgid ""
6335 "int\n"
6336 "main(int argc, char *argv[])\n"
6337 "{\n"
6338 "    int s, opt, inheritsched, use_null_attrib, policy;\n"
6339 "    pthread_t thread;\n"
6340 "    pthread_attr_t attr;\n"
6341 "    pthread_attr_t *attrp;\n"
6342 "    char *attr_sched_str, *main_sched_str, *inheritsched_str;\n"
6343 "    struct sched_param param;\n"
6344 msgstr ""
6345
6346 #. type: Plain text
6347 #: build/C/man3/pthread_setschedparam.3:323
6348 #, no-wrap
6349 msgid "    /* Process command-line options */\n"
6350 msgstr ""
6351
6352 #. type: Plain text
6353 #: build/C/man3/pthread_setschedparam.3:328
6354 #, no-wrap
6355 msgid ""
6356 "    use_null_attrib = 0;\n"
6357 "    attr_sched_str = NULL;\n"
6358 "    main_sched_str = NULL;\n"
6359 "    inheritsched_str = NULL;\n"
6360 msgstr ""
6361
6362 #. type: Plain text
6363 #: build/C/man3/pthread_setschedparam.3:338
6364 #, no-wrap
6365 msgid ""
6366 "    while ((opt = getopt(argc, argv, \"a:Ai:m:\")) != -1) {\n"
6367 "        switch (opt) {\n"
6368 "        case \\(aqa\\(aq: attr_sched_str = optarg;      break;\n"
6369 "        case \\(aqA\\(aq: use_null_attrib = 1;          break;\n"
6370 "        case \\(aqi\\(aq: inheritsched_str = optarg;    break;\n"
6371 "        case \\(aqm\\(aq: main_sched_str = optarg;      break;\n"
6372 "        default:  usage(argv[0], \"Unrecognized option\\en\");\n"
6373 "        }\n"
6374 "    }\n"
6375 msgstr ""
6376
6377 #. type: Plain text
6378 #: build/C/man3/pthread_setschedparam.3:342
6379 #, no-wrap
6380 msgid ""
6381 "    if (use_null_attrib &&\n"
6382 "            (inheritsched_str != NULL || attr_sched_str != NULL))\n"
6383 "        usage(argv[0], \"Can\\(aqt specify -A with -i or -a\\en\");\n"
6384 msgstr ""
6385
6386 #. type: Plain text
6387 #: build/C/man3/pthread_setschedparam.3:345
6388 #, no-wrap
6389 msgid ""
6390 "    /* Optionally set scheduling attributes of main thread,\n"
6391 "       and display the attributes */\n"
6392 msgstr ""
6393
6394 #. type: Plain text
6395 #: build/C/man3/pthread_setschedparam.3:350
6396 #, no-wrap
6397 msgid ""
6398 "    if (main_sched_str != NULL) {\n"
6399 "        if (!get_policy(main_sched_str[0], &policy))\n"
6400 "            usage(argv[0], \"Bad policy for main thread (-m)\\en\");\n"
6401 "        param.sched_priority = strtol(&main_sched_str[1], NULL, 0);\n"
6402 msgstr ""
6403
6404 #. type: Plain text
6405 #: build/C/man3/pthread_setschedparam.3:355
6406 #, no-wrap
6407 msgid ""
6408 "        s = pthread_setschedparam(pthread_self(), policy, &param);\n"
6409 "        if (s != 0)\n"
6410 "            handle_error_en(s, \"pthread_setschedparam\");\n"
6411 "    }\n"
6412 msgstr ""
6413
6414 #. type: Plain text
6415 #: build/C/man3/pthread_setschedparam.3:358
6416 #, no-wrap
6417 msgid ""
6418 "    display_thread_sched_attr(\"Scheduler settings of main thread\");\n"
6419 "    printf(\"\\en\");\n"
6420 msgstr ""
6421
6422 #. type: Plain text
6423 #: build/C/man3/pthread_setschedparam.3:360
6424 #, no-wrap
6425 msgid "    /* Initialize thread attributes object according to options */\n"
6426 msgstr ""
6427
6428 #. type: Plain text
6429 #: build/C/man3/pthread_setschedparam.3:369
6430 #, no-wrap
6431 msgid ""
6432 "    if (!use_null_attrib) {\n"
6433 "        s = pthread_attr_init(&attr);\n"
6434 "        if (s != 0)\n"
6435 "            handle_error_en(s, \"pthread_attr_init\");\n"
6436 "        attrp = &attr;\n"
6437 "    }\n"
6438 msgstr ""
6439
6440 #. type: Plain text
6441 #: build/C/man3/pthread_setschedparam.3:377
6442 #, no-wrap
6443 msgid ""
6444 "    if (inheritsched_str != NULL) {\n"
6445 "        if (inheritsched_str[0] == \\(aqe\\(aq)\n"
6446 "            inheritsched = PTHREAD_EXPLICIT_SCHED;\n"
6447 "        else if (inheritsched_str[0] == \\(aqi\\(aq)\n"
6448 "            inheritsched = PTHREAD_INHERIT_SCHED;\n"
6449 "        else\n"
6450 "            usage(argv[0], \"Value for -i must be \\(aqe\\(aq or "
6451 "\\(aqi\\(aq\\en\");\n"
6452 msgstr ""
6453
6454 #. type: Plain text
6455 #: build/C/man3/pthread_setschedparam.3:382
6456 #, no-wrap
6457 msgid ""
6458 "        s = pthread_attr_setinheritsched(&attr, inheritsched);\n"
6459 "        if (s != 0)\n"
6460 "            handle_error_en(s, \"pthread_attr_setinheritsched\");\n"
6461 "    }\n"
6462 msgstr ""
6463
6464 #. type: Plain text
6465 #: build/C/man3/pthread_setschedparam.3:388
6466 #, no-wrap
6467 msgid ""
6468 "    if (attr_sched_str != NULL) {\n"
6469 "        if (!get_policy(attr_sched_str[0], &policy))\n"
6470 "            usage(argv[0],\n"
6471 "                    \"Bad policy for \\(aqattr\\(aq (-a)\\en\");\n"
6472 "        param.sched_priority = strtol(&attr_sched_str[1], NULL, 0);\n"
6473 msgstr ""
6474
6475 #. type: Plain text
6476 #: build/C/man3/pthread_setschedparam.3:396
6477 #, no-wrap
6478 msgid ""
6479 "        s = pthread_attr_setschedpolicy(&attr, policy);\n"
6480 "        if (s != 0)\n"
6481 "            handle_error_en(s, \"pthread_attr_setschedpolicy\");\n"
6482 "        s = pthread_attr_setschedparam(&attr, &param);\n"
6483 "        if (s != 0)\n"
6484 "            handle_error_en(s, \"pthread_attr_setschedparam\");\n"
6485 "    }\n"
6486 msgstr ""
6487
6488 #. type: Plain text
6489 #: build/C/man3/pthread_setschedparam.3:399
6490 #, no-wrap
6491 msgid ""
6492 "    /* If we initialized a thread attributes object, display\n"
6493 "       the scheduling attributes that were set in the object */\n"
6494 msgstr ""
6495
6496 #. type: Plain text
6497 #: build/C/man3/pthread_setschedparam.3:407
6498 #, no-wrap
6499 msgid ""
6500 "    if (attrp != NULL) {\n"
6501 "        s = pthread_attr_getschedparam(&attr, &param);\n"
6502 "        if (s != 0)\n"
6503 "            handle_error_en(s, \"pthread_attr_getschedparam\");\n"
6504 "        s = pthread_attr_getschedpolicy(&attr, &policy);\n"
6505 "        if (s != 0)\n"
6506 "            handle_error_en(s, \"pthread_attr_getschedpolicy\");\n"
6507 msgstr ""
6508
6509 #. type: Plain text
6510 #: build/C/man3/pthread_setschedparam.3:410
6511 #, no-wrap
6512 msgid ""
6513 "        printf(\"Scheduler settings in \\(aqattr\\(aq\\en\");\n"
6514 "        display_sched_attr(policy, &param);\n"
6515 msgstr ""
6516
6517 #. type: Plain text
6518 #: build/C/man3/pthread_setschedparam.3:418
6519 #, no-wrap
6520 msgid ""
6521 "        s = pthread_attr_getinheritsched(&attr, &inheritsched);\n"
6522 "        printf(\"    inheritsched is %s\\en\",\n"
6523 "                (inheritsched == PTHREAD_INHERIT_SCHED)  ? \"INHERIT\" :\n"
6524 "                (inheritsched == PTHREAD_EXPLICIT_SCHED) ? \"EXPLICIT\" :\n"
6525 "                \"???\");\n"
6526 "        printf(\"\\en\");\n"
6527 "    }\n"
6528 msgstr ""
6529
6530 #. type: Plain text
6531 #: build/C/man3/pthread_setschedparam.3:420
6532 #, no-wrap
6533 msgid "    /* Create a thread that will display its scheduling attributes */\n"
6534 msgstr ""
6535
6536 #. type: Plain text
6537 #: build/C/man3/pthread_setschedparam.3:424
6538 #, no-wrap
6539 msgid ""
6540 "    s = pthread_create(&thread, attrp, &thread_start, NULL);\n"
6541 "    if (s != 0)\n"
6542 "        handle_error_en(s, \"pthread_create\");\n"
6543 msgstr ""
6544
6545 #. type: Plain text
6546 #: build/C/man3/pthread_setschedparam.3:426
6547 #, no-wrap
6548 msgid "    /* Destroy unneeded thread attributes object */\n"
6549 msgstr ""
6550
6551 #. type: Plain text
6552 #: build/C/man3/pthread_setschedparam.3:432
6553 #, no-wrap
6554 msgid ""
6555 "    if (!use_null_attrib) {\n"
6556 "      s = pthread_attr_destroy(&attr);\n"
6557 "      if (s != 0)\n"
6558 "          handle_error_en(s, \"pthread_attr_destroy\");\n"
6559 "    }\n"
6560 msgstr ""
6561
6562 #. type: Plain text
6563 #: build/C/man3/pthread_setschedparam.3:436
6564 #, no-wrap
6565 msgid ""
6566 "    s = pthread_join(thread, NULL);\n"
6567 "    if (s != 0)\n"
6568 "        handle_error_en(s, \"pthread_join\");\n"
6569 msgstr ""
6570
6571 #. type: Plain text
6572 #: build/C/man3/pthread_setschedparam.3:453
6573 msgid ""
6574 "B<getrlimit>(2), B<sched_get_priority_min>(2), B<pthread_attr_init>(3), "
6575 "B<pthread_attr_setinheritsched>(3), B<pthread_attr_setschedparam>(3), "
6576 "B<pthread_attr_setschedpolicy>(3), B<pthread_create>(3), B<pthread_self>(3), "
6577 "B<pthread_setschedprio>(3), B<pthreads>(7), B<sched>(7)"
6578 msgstr ""
6579
6580 #. type: TH
6581 #: build/C/man3/pthread_setschedprio.3:26
6582 #, no-wrap
6583 msgid "PTHREAD_SETSCHEDPRIO"
6584 msgstr ""
6585
6586 #. type: Plain text
6587 #: build/C/man3/pthread_setschedprio.3:29
6588 msgid "pthread_setschedprio - set scheduling priority of a thread"
6589 msgstr ""
6590
6591 #. type: Plain text
6592 #: build/C/man3/pthread_setschedprio.3:34
6593 #, no-wrap
6594 msgid "B<int pthread_setschedprio(pthread_t >I<thread>B<, int >I<prio>B<);>\n"
6595 msgstr ""
6596
6597 #.  FIXME . nptl/pthread_setschedprio.c has the following
6598 #.    /* If the thread should have higher priority because of some
6599 #.       PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */
6600 #.  Eventually (perhaps after writing the mutexattr pages), we
6601 #.  may want to add something on the topic to this page.
6602 #.  nptl/pthread_setschedparam.c has a similar case.
6603 #. type: Plain text
6604 #: build/C/man3/pthread_setschedprio.3:53
6605 msgid ""
6606 "The B<pthread_setschedprio>()  function sets the scheduling priority of the "
6607 "thread I<thread> to the value specified in I<prio>.  (By contrast "
6608 "B<pthread_setschedparam>(3)  changes both the scheduling policy and priority "
6609 "of a thread.)"
6610 msgstr ""
6611
6612 #. type: Plain text
6613 #: build/C/man3/pthread_setschedprio.3:61
6614 msgid ""
6615 "On success, this function returns 0; on error, it returns a nonzero error "
6616 "number.  If B<pthread_setschedprio>()  fails, the scheduling priority of "
6617 "I<thread> is not changed."
6618 msgstr ""
6619
6620 #. type: Plain text
6621 #: build/C/man3/pthread_setschedprio.3:66
6622 msgid "I<prio> is not valid for the scheduling policy of the specified thread."
6623 msgstr ""
6624
6625 #. type: Plain text
6626 #: build/C/man3/pthread_setschedprio.3:70
6627 msgid ""
6628 "The caller does not have appropriate privileges to set the specified "
6629 "priority."
6630 msgstr ""
6631
6632 #. type: Plain text
6633 #: build/C/man3/pthread_setschedprio.3:81
6634 msgid ""
6635 "POSIX.1-2001 also documents an B<ENOTSUP> (\"attempt was made to set the "
6636 "priority to an unsupported value\") error for B<pthread_setschedparam>(3)."
6637 msgstr ""
6638
6639 #. type: Plain text
6640 #: build/C/man3/pthread_setschedprio.3:83
6641 msgid "This function is available in glibc since version 2.3.4."
6642 msgstr ""
6643
6644 #. type: Plain text
6645 #: build/C/man3/pthread_setschedprio.3:88
6646 msgid "The B<pthread_setschedprio>()  function is thread-safe."
6647 msgstr ""
6648
6649 #. type: Plain text
6650 #: build/C/man3/pthread_setschedprio.3:96
6651 msgid ""
6652 "For a description of the permissions required to, and the effect of, "
6653 "changing a thread's scheduling priority, and details of the permitted ranges "
6654 "for priorities in each scheduling policy, see B<sched>(7)."
6655 msgstr ""
6656
6657 #. type: Plain text
6658 #: build/C/man3/pthread_setschedprio.3:109
6659 msgid ""
6660 "B<getrlimit>(2), B<sched_get_priority_min>(2), B<pthread_attr_init>(3), "
6661 "B<pthread_attr_setinheritsched>(3), B<pthread_attr_setschedparam>(3), "
6662 "B<pthread_attr_setschedpolicy>(3), B<pthread_create>(3), B<pthread_self>(3), "
6663 "B<pthread_setschedparam>(3), B<pthreads>(7), B<sched>(7)"
6664 msgstr ""
6665
6666 #. type: TH
6667 #: build/C/man3/pthread_sigmask.3:26
6668 #, no-wrap
6669 msgid "PTHREAD_SIGMASK"
6670 msgstr ""
6671
6672 #. type: TH
6673 #: build/C/man3/pthread_sigmask.3:26 build/C/man3/pthread_testcancel.3:26
6674 #, no-wrap
6675 msgid "2014-05-19"
6676 msgstr ""
6677
6678 #. type: Plain text
6679 #: build/C/man3/pthread_sigmask.3:29
6680 msgid "pthread_sigmask - examine and change mask of blocked signals"
6681 msgstr ""
6682
6683 #. type: Plain text
6684 #: build/C/man3/pthread_sigmask.3:35
6685 #, no-wrap
6686 msgid ""
6687 "B<int pthread_sigmask(int >I<how>B<, const sigset_t *>I<set>B<, sigset_t "
6688 "*>I<oldset>B<);>\n"
6689 msgstr ""
6690
6691 #. type: Plain text
6692 #: build/C/man3/pthread_sigmask.3:46
6693 msgid "B<pthread_sigmask>():"
6694 msgstr ""
6695
6696 #. type: Plain text
6697 #: build/C/man3/pthread_sigmask.3:58
6698 msgid ""
6699 "The B<pthread_sigmask>()  function is just like B<sigprocmask>(2), with the "
6700 "difference that its use in multithreaded programs is explicitly specified by "
6701 "POSIX.1-2001.  Other differences are noted in this page."
6702 msgstr ""
6703
6704 #. type: Plain text
6705 #: build/C/man3/pthread_sigmask.3:61
6706 msgid ""
6707 "For a description of the arguments and operation of this function, see "
6708 "B<sigprocmask>(2)."
6709 msgstr ""
6710
6711 #. type: Plain text
6712 #: build/C/man3/pthread_sigmask.3:66
6713 msgid ""
6714 "On success, B<pthread_sigmask>()  returns 0; on error, it returns an error "
6715 "number."
6716 msgstr ""
6717
6718 #. type: Plain text
6719 #: build/C/man3/pthread_sigmask.3:69
6720 msgid "See B<sigprocmask>(2)."
6721 msgstr ""
6722
6723 #. type: Plain text
6724 #: build/C/man3/pthread_sigmask.3:74
6725 msgid "The B<pthread_sigmask>()  function is thread-safe."
6726 msgstr ""
6727
6728 #. type: Plain text
6729 #: build/C/man3/pthread_sigmask.3:78
6730 msgid "A new thread inherits a copy of its creator's signal mask."
6731 msgstr ""
6732
6733 #. type: Plain text
6734 #: build/C/man3/pthread_sigmask.3:83
6735 msgid ""
6736 "The program below blocks some signals in the main thread, and then creates a "
6737 "dedicated thread to fetch those signals via B<sigwait>(3).  The following "
6738 "shell session demonstrates its use:"
6739 msgstr ""
6740
6741 #. type: Plain text
6742 #: build/C/man3/pthread_sigmask.3:94
6743 #, no-wrap
6744 msgid ""
6745 "$B< ./a.out &>\n"
6746 "[1] 5423\n"
6747 "$B< kill -QUIT %1>\n"
6748 "Signal handling thread got signal 3\n"
6749 "$B< kill -USR1 %1>\n"
6750 "Signal handling thread got signal 10\n"
6751 "$B< kill -TERM %1>\n"
6752 "[1]+  Terminated              ./a.out\n"
6753 msgstr ""
6754
6755 #. type: Plain text
6756 #: build/C/man3/pthread_sigmask.3:105
6757 #, no-wrap
6758 msgid ""
6759 "#include E<lt>pthread.hE<gt>\n"
6760 "#include E<lt>stdio.hE<gt>\n"
6761 "#include E<lt>stdlib.hE<gt>\n"
6762 "#include E<lt>unistd.hE<gt>\n"
6763 "#include E<lt>signal.hE<gt>\n"
6764 "#include E<lt>errno.hE<gt>\n"
6765 msgstr ""
6766
6767 #. type: Plain text
6768 #: build/C/man3/pthread_sigmask.3:107
6769 #, no-wrap
6770 msgid "/* Simple error handling functions */\n"
6771 msgstr ""
6772
6773 #. type: Plain text
6774 #: build/C/man3/pthread_sigmask.3:116
6775 #, no-wrap
6776 msgid ""
6777 "static void *\n"
6778 "sig_thread(void *arg)\n"
6779 "{\n"
6780 "    sigset_t *set = arg;\n"
6781 "    int s, sig;\n"
6782 msgstr ""
6783
6784 #. type: Plain text
6785 #: build/C/man3/pthread_sigmask.3:124
6786 #, no-wrap
6787 msgid ""
6788 "    for (;;) {\n"
6789 "        s = sigwait(set, &sig);\n"
6790 "        if (s != 0)\n"
6791 "            handle_error_en(s, \"sigwait\");\n"
6792 "        printf(\"Signal handling thread got signal %d\\en\", sig);\n"
6793 "    }\n"
6794 "}\n"
6795 msgstr ""
6796
6797 #. type: Plain text
6798 #: build/C/man3/pthread_sigmask.3:131
6799 #, no-wrap
6800 msgid ""
6801 "int\n"
6802 "main(int argc, char *argv[])\n"
6803 "{\n"
6804 "    pthread_t thread;\n"
6805 "    sigset_t set;\n"
6806 "    int s;\n"
6807 msgstr ""
6808
6809 #. type: Plain text
6810 #: build/C/man3/pthread_sigmask.3:134
6811 #, no-wrap
6812 msgid ""
6813 "    /* Block SIGQUIT and SIGUSR1; other threads created by main()\n"
6814 "       will inherit a copy of the signal mask. */\n"
6815 msgstr ""
6816
6817 #. type: Plain text
6818 #: build/C/man3/pthread_sigmask.3:141
6819 #, no-wrap
6820 msgid ""
6821 "    sigemptyset(&set);\n"
6822 "    sigaddset(&set, SIGQUIT);\n"
6823 "    sigaddset(&set, SIGUSR1);\n"
6824 "    s = pthread_sigmask(SIG_BLOCK, &set, NULL);\n"
6825 "    if (s != 0)\n"
6826 "        handle_error_en(s, \"pthread_sigmask\");\n"
6827 msgstr ""
6828
6829 #. type: Plain text
6830 #: build/C/man3/pthread_sigmask.3:145
6831 #, no-wrap
6832 msgid ""
6833 "    s = pthread_create(&thread, NULL, &sig_thread, (void *) &set);\n"
6834 "    if (s != 0)\n"
6835 "        handle_error_en(s, \"pthread_create\");\n"
6836 msgstr ""
6837
6838 #. type: Plain text
6839 #: build/C/man3/pthread_sigmask.3:148
6840 #, no-wrap
6841 msgid ""
6842 "    /* Main thread carries on to create other threads and/or do\n"
6843 "       other work */\n"
6844 msgstr ""
6845
6846 #. type: Plain text
6847 #: build/C/man3/pthread_sigmask.3:151
6848 #, no-wrap
6849 msgid ""
6850 "    pause();            /* Dummy pause so we can test program */\n"
6851 "}\n"
6852 msgstr ""
6853
6854 #. type: Plain text
6855 #: build/C/man3/pthread_sigmask.3:160
6856 msgid ""
6857 "B<sigaction>(2), B<sigpending>(2), B<sigprocmask>(2), B<pthread_create>(3), "
6858 "B<pthread_kill>(3), B<sigsetops>(3), B<pthreads>(7), B<signal>(7)"
6859 msgstr ""
6860
6861 #. type: TH
6862 #: build/C/man3/pthread_sigqueue.3:25
6863 #, no-wrap
6864 msgid "PTHREAD_SIGQUEUE"
6865 msgstr ""
6866
6867 #. type: Plain text
6868 #: build/C/man3/pthread_sigqueue.3:28
6869 msgid "pthread_sigqueue - queue a signal and data to a thread"
6870 msgstr ""
6871
6872 #. type: Plain text
6873 #: build/C/man3/pthread_sigqueue.3:32
6874 #, no-wrap
6875 msgid ""
6876 "B<#include E<lt>signal.hE<gt>>\n"
6877 "B<#include E<lt>pthread.hE<gt>>\n"
6878 msgstr ""
6879
6880 #. type: Plain text
6881 #: build/C/man3/pthread_sigqueue.3:35
6882 #, no-wrap
6883 msgid ""
6884 "B<int pthread_sigqueue(pthread_t >I<thread>B<, int >I<sig>B<,>\n"
6885 "B<                     const union sigval >I<value>B<);>\n"
6886 msgstr ""
6887
6888 #. type: Plain text
6889 #: build/C/man3/pthread_sigqueue.3:46
6890 msgid "B<pthread_sigqueue>(): _GNU_SOURCE"
6891 msgstr ""
6892
6893 #. type: Plain text
6894 #: build/C/man3/pthread_sigqueue.3:54
6895 msgid ""
6896 "The B<pthread_sigqueue>()  function performs a similar task to "
6897 "B<sigqueue>(3), but, rather than sending a signal to a process, it sends a "
6898 "signal to a thread in the same process as the calling thread."
6899 msgstr ""
6900
6901 #. type: Plain text
6902 #: build/C/man3/pthread_sigqueue.3:66
6903 msgid ""
6904 "The I<thread> argument is the ID of a thread in the same process as the "
6905 "caller.  The I<sig> argument specifies the signal to be sent.  The I<value> "
6906 "argument specifies data to accompany the signal; see B<sigqueue>(3)  for "
6907 "details."
6908 msgstr ""
6909
6910 #. type: Plain text
6911 #: build/C/man3/pthread_sigqueue.3:71
6912 msgid ""
6913 "On success, B<pthread_sigqueue>()  returns 0; on error, it returns an error "
6914 "number."
6915 msgstr ""
6916
6917 #. type: Plain text
6918 #: build/C/man3/pthread_sigqueue.3:78
6919 msgid ""
6920 "The limit of signals which may be queued has been reached.  (See "
6921 "B<signal>(7)  for further information.)"
6922 msgstr ""
6923
6924 #. type: Plain text
6925 #: build/C/man3/pthread_sigqueue.3:82
6926 msgid "I<sig> was invalid."
6927 msgstr ""
6928
6929 #. type: TP
6930 #: build/C/man3/pthread_sigqueue.3:82
6931 #, no-wrap
6932 msgid "B<ENOSYS>"
6933 msgstr ""
6934
6935 #. type: Plain text
6936 #: build/C/man3/pthread_sigqueue.3:86
6937 msgid "B<pthread_sigqueue>()  is not supported on this system."
6938 msgstr ""
6939
6940 #. type: Plain text
6941 #: build/C/man3/pthread_sigqueue.3:90
6942 msgid "I<thread> is not valid."
6943 msgstr ""
6944
6945 #. type: Plain text
6946 #: build/C/man3/pthread_sigqueue.3:94
6947 msgid "The B<pthread_sigqueue>()  function first appeared in glibc 2.11."
6948 msgstr ""
6949
6950 #. type: Plain text
6951 #: build/C/man3/pthread_sigqueue.3:99
6952 msgid "The B<pthread_sigqueue>()  function is thread-safe."
6953 msgstr ""
6954
6955 #. type: Plain text
6956 #: build/C/man3/pthread_sigqueue.3:101
6957 msgid "This function is a GNU extension."
6958 msgstr ""
6959
6960 #. type: Plain text
6961 #: build/C/man3/pthread_sigqueue.3:108
6962 msgid ""
6963 "B<rt_tgsigqueueinfo>(2), B<sigaction>(2), B<pthread_sigmask>(3), "
6964 "B<sigqueue>(3), B<sigwait>(3), B<pthreads>(7), B<signal>(7)"
6965 msgstr ""
6966
6967 #. type: TH
6968 #: build/C/man3/pthread_testcancel.3:26
6969 #, no-wrap
6970 msgid "PTHREAD_TESTCANCEL"
6971 msgstr ""
6972
6973 #. type: Plain text
6974 #: build/C/man3/pthread_testcancel.3:29
6975 msgid "pthread_testcancel - request delivery of any pending cancellation request"
6976 msgstr ""
6977
6978 #. type: Plain text
6979 #: build/C/man3/pthread_testcancel.3:34
6980 #, no-wrap
6981 msgid "B<void pthread_testcancel(void);>\n"
6982 msgstr ""
6983
6984 #. type: Plain text
6985 #: build/C/man3/pthread_testcancel.3:43
6986 msgid ""
6987 "Calling B<pthread_testcancel>()  creates a cancellation point within the "
6988 "calling thread, so that a thread that is otherwise executing code that "
6989 "contains no cancellation points will respond to a cancellation request."
6990 msgstr ""
6991
6992 #. type: Plain text
6993 #: build/C/man3/pthread_testcancel.3:50
6994 msgid ""
6995 "If cancelability is disabled (using B<pthread_setcancelstate>(3)), or no "
6996 "cancellation request is pending, then a call to B<pthread_testcancel>()  has "
6997 "no effect."
6998 msgstr ""
6999
7000 #. type: Plain text
7001 #: build/C/man3/pthread_testcancel.3:54
7002 msgid ""
7003 "This function does not return a value.  If the calling thread is canceled as "
7004 "a consequence of a call to this function, then the function does not return."
7005 msgstr ""
7006
7007 #. type: Plain text
7008 #: build/C/man3/pthread_testcancel.3:63
7009 msgid "The B<pthread_testcancel>()  function is thread-safe."
7010 msgstr ""
7011
7012 #. type: Plain text
7013 #: build/C/man3/pthread_testcancel.3:68
7014 msgid "See B<pthread_cleanup_push>(3)."
7015 msgstr ""
7016
7017 #. type: Plain text
7018 #: build/C/man3/pthread_testcancel.3:72
7019 msgid ""
7020 "B<pthread_cancel>(3), B<pthread_cleanup_push>(3), "
7021 "B<pthread_setcancelstate>(3), B<pthreads>(7)"
7022 msgstr ""
7023
7024 #. type: TH
7025 #: build/C/man3/pthread_tryjoin_np.3:26
7026 #, no-wrap
7027 msgid "PTHREAD_TRYJOIN_NP"
7028 msgstr ""
7029
7030 #. type: TH
7031 #: build/C/man3/pthread_tryjoin_np.3:26
7032 #, no-wrap
7033 msgid "2015-01-10"
7034 msgstr ""
7035
7036 #. type: Plain text
7037 #: build/C/man3/pthread_tryjoin_np.3:30
7038 msgid ""
7039 "pthread_tryjoin_np, pthread_timedjoin_np - try to join with a terminated "
7040 "thread"
7041 msgstr ""
7042
7043 #. type: Plain text
7044 #: build/C/man3/pthread_tryjoin_np.3:36
7045 #, no-wrap
7046 msgid "B<int pthread_tryjoin_np(pthread_t >I<thread>B<, void **>I<retval>B<);>\n"
7047 msgstr ""
7048
7049 #. type: Plain text
7050 #: build/C/man3/pthread_tryjoin_np.3:39
7051 #, no-wrap
7052 msgid ""
7053 "B<int pthread_timedjoin_np(pthread_t >I<thread>B<, void **>I<retval>B<,>\n"
7054 "B<                         const struct timespec *>I<abstime>B<);>\n"
7055 msgstr ""
7056
7057 #. type: Plain text
7058 #: build/C/man3/pthread_tryjoin_np.3:46
7059 msgid ""
7060 "These functions operate in the same way as B<pthread_join>(3), except for "
7061 "the differences described on this page."
7062 msgstr ""
7063
7064 #. type: Plain text
7065 #: build/C/man3/pthread_tryjoin_np.3:58
7066 msgid ""
7067 "The B<pthread_tryjoin_np>()  function performs a nonblocking join with the "
7068 "thread I<thread>, returning the exit status of the thread in I<*retval>.  If "
7069 "I<thread> has not yet terminated, then instead of blocking, as is done by "
7070 "B<pthread_join>(3), the call returns an error."
7071 msgstr ""
7072
7073 #. type: Plain text
7074 #: build/C/man3/pthread_tryjoin_np.3:76
7075 msgid ""
7076 "The B<pthread_timedjoin_np>()  function performs a join-with-timeout.  If "
7077 "I<thread> has not yet terminated, then the call blocks until a maximum time, "
7078 "specified in I<abstime>.  If the timeout expires before I<thread> "
7079 "terminates, the call returns an error.  The I<abstime> argument is a "
7080 "structure of the following form, specifying an absolute time measured since "
7081 "the Epoch (see B<time>(2)):"
7082 msgstr ""
7083
7084 #. type: Plain text
7085 #: build/C/man3/pthread_tryjoin_np.3:83
7086 #, no-wrap
7087 msgid ""
7088 "struct timespec {\n"
7089 "    time_t tv_sec;     /* seconds */\n"
7090 "    long   tv_nsec;    /* nanoseconds */\n"
7091 "};\n"
7092 msgstr ""
7093
7094 #. type: Plain text
7095 #: build/C/man3/pthread_tryjoin_np.3:89
7096 msgid "On success, these functions return 0; on error, they return an error number."
7097 msgstr ""
7098
7099 #. type: Plain text
7100 #: build/C/man3/pthread_tryjoin_np.3:94
7101 msgid ""
7102 "These functions can fail with the same errors as B<pthread_join>(3).  "
7103 "B<pthread_tryjoin_np>()  can in addition fail with the following error:"
7104 msgstr ""
7105
7106 #. type: TP
7107 #: build/C/man3/pthread_tryjoin_np.3:94
7108 #, no-wrap
7109 msgid "B<EBUSY>"
7110 msgstr ""
7111
7112 #. type: Plain text
7113 #: build/C/man3/pthread_tryjoin_np.3:98
7114 msgid "I<thread> had not yet terminated at the time of the call."
7115 msgstr ""
7116
7117 #. type: Plain text
7118 #: build/C/man3/pthread_tryjoin_np.3:101
7119 msgid "B<pthread_timedjoin_np>()  can in addition fail with the following errors:"
7120 msgstr ""
7121
7122 #. type: TP
7123 #: build/C/man3/pthread_tryjoin_np.3:101
7124 #, no-wrap
7125 msgid "B<ETIMEDOUT>"
7126 msgstr ""
7127
7128 #. type: Plain text
7129 #: build/C/man3/pthread_tryjoin_np.3:106
7130 msgid "The call timed out before I<thread> terminated."
7131 msgstr ""
7132
7133 #. type: Plain text
7134 #: build/C/man3/pthread_tryjoin_np.3:114
7135 msgid ""
7136 "I<abstime> value is invalid (I<tv_sec> is less than 0 or I<tv_nsec> is "
7137 "greater than 1e9)."
7138 msgstr ""
7139
7140 #. type: Plain text
7141 #: build/C/man3/pthread_tryjoin_np.3:118
7142 msgid "B<pthread_timedjoin_np>()  never returns the error B<EINTR>."
7143 msgstr ""
7144
7145 #. type: Plain text
7146 #: build/C/man3/pthread_tryjoin_np.3:120
7147 msgid "These functions first appeared in glibc in version 2.3.3."
7148 msgstr ""
7149
7150 #. type: Plain text
7151 #: build/C/man3/pthread_tryjoin_np.3:125
7152 msgid "The following code waits to join for up to 5 seconds:"
7153 msgstr ""
7154
7155 #. type: Plain text
7156 #: build/C/man3/pthread_tryjoin_np.3:129
7157 #, no-wrap
7158 msgid ""
7159 "    struct timespec ts;\n"
7160 "    int s;\n"
7161 msgstr ""
7162
7163 #. type: Plain text
7164 #: build/C/man3/pthread_tryjoin_np.3:131
7165 #, no-wrap
7166 msgid "    ...\n"
7167 msgstr ""
7168
7169 #. type: Plain text
7170 #: build/C/man3/pthread_tryjoin_np.3:135
7171 #, no-wrap
7172 msgid ""
7173 "    if (clock_gettime(CLOCK_REALTIME, &ts) == -1) {\n"
7174 "\t/* Handle error */\n"
7175 "    }\n"
7176 msgstr ""
7177
7178 #. type: Plain text
7179 #: build/C/man3/pthread_tryjoin_np.3:137
7180 #, no-wrap
7181 msgid "    ts.tv_sec += 5;\n"
7182 msgstr ""
7183
7184 #. type: Plain text
7185 #: build/C/man3/pthread_tryjoin_np.3:142
7186 #, no-wrap
7187 msgid ""
7188 "    s = pthread_timedjoin_np(thread, NULL, &ts);\n"
7189 "    if (s != 0) {\n"
7190 "        /* Handle error */\n"
7191 "    }\n"
7192 msgstr ""
7193
7194 #. type: Plain text
7195 #: build/C/man3/pthread_tryjoin_np.3:147
7196 msgid "B<clock_gettime>(2), B<pthread_exit>(3), B<pthread_join>(3), B<pthreads>(7)"
7197 msgstr ""
7198
7199 #. type: TH
7200 #: build/C/man3/pthread_yield.3:25
7201 #, no-wrap
7202 msgid "PTHREAD_YIELD"
7203 msgstr ""
7204
7205 #. type: Plain text
7206 #: build/C/man3/pthread_yield.3:28
7207 msgid "pthread_yield - yield the processor"
7208 msgstr ""
7209
7210 #. type: Plain text
7211 #: build/C/man3/pthread_yield.3:34
7212 #, no-wrap
7213 msgid "B<int pthread_yield(void);>\n"
7214 msgstr ""
7215
7216 #. type: Plain text
7217 #: build/C/man3/pthread_yield.3:44
7218 msgid ""
7219 "B<pthread_yield>()  causes the calling thread to relinquish the CPU.  The "
7220 "thread is placed at the end of the run queue for its static priority and "
7221 "another thread is scheduled to run.  For further details, see "
7222 "B<sched_yield>(2)"
7223 msgstr ""
7224
7225 #. type: Plain text
7226 #: build/C/man3/pthread_yield.3:49
7227 msgid ""
7228 "On success, B<pthread_yield>()  returns 0; on error, it returns an error "
7229 "number."
7230 msgstr ""
7231
7232 #. type: Plain text
7233 #: build/C/man3/pthread_yield.3:53
7234 msgid ""
7235 "On Linux, this call always succeeds (but portable and future-proof "
7236 "applications should nevertheless handle a possible error return)."
7237 msgstr ""
7238
7239 #. type: Plain text
7240 #: build/C/man3/pthread_yield.3:58
7241 msgid "The B<pthread_yield>()  function is thread-safe."
7242 msgstr ""
7243
7244 #.  e.g., the BSDs, Tru64, AIX, and Irix.
7245 #. type: Plain text
7246 #: build/C/man3/pthread_yield.3:64
7247 msgid ""
7248 "This call is nonstandard, but present on several other systems.  Use the "
7249 "standardized B<sched_yield>(2)  instead."
7250 msgstr ""
7251
7252 #. type: Plain text
7253 #: build/C/man3/pthread_yield.3:67
7254 msgid "On Linux, this function is implemented as a call to B<sched_yield>(2)."
7255 msgstr ""
7256
7257 #. type: Plain text
7258 #: build/C/man3/pthread_yield.3:70
7259 msgid "B<sched_yield>(2), B<pthreads>(7), B<sched>(7)"
7260 msgstr ""
7261
7262 #. type: TH
7263 #: build/C/man7/pthreads.7:26
7264 #, no-wrap
7265 msgid "PTHREADS"
7266 msgstr ""
7267
7268 #. type: Plain text
7269 #: build/C/man7/pthreads.7:29
7270 msgid "pthreads - POSIX threads"
7271 msgstr ""
7272
7273 #. type: Plain text
7274 #: build/C/man7/pthreads.7:36
7275 msgid ""
7276 "POSIX.1 specifies a set of interfaces (functions, header files) for threaded "
7277 "programming commonly known as POSIX threads, or Pthreads.  A single process "
7278 "can contain multiple threads, all of which are executing the same program.  "
7279 "These threads share the same global memory (data and heap segments), but "
7280 "each thread has its own stack (automatic variables)."
7281 msgstr ""
7282
7283 #. type: Plain text
7284 #: build/C/man7/pthreads.7:39
7285 msgid ""
7286 "POSIX.1 also requires that threads share a range of other attributes (i.e., "
7287 "these attributes are process-wide rather than per-thread):"
7288 msgstr ""
7289
7290 #. type: IP
7291 #: build/C/man7/pthreads.7:39 build/C/man7/pthreads.7:41 build/C/man7/pthreads.7:43 build/C/man7/pthreads.7:45 build/C/man7/pthreads.7:47 build/C/man7/pthreads.7:49 build/C/man7/pthreads.7:51 build/C/man7/pthreads.7:54 build/C/man7/pthreads.7:56 build/C/man7/pthreads.7:59 build/C/man7/pthreads.7:65 build/C/man7/pthreads.7:70 build/C/man7/pthreads.7:73 build/C/man7/pthreads.7:76 build/C/man7/pthreads.7:84 build/C/man7/pthreads.7:88 build/C/man7/pthreads.7:91 build/C/man7/pthreads.7:95 build/C/man7/pthreads.7:98 build/C/man7/pthreads.7:103 build/C/man7/pthreads.7:106 build/C/man7/pthreads.7:683 build/C/man7/pthreads.7:690 build/C/man7/pthreads.7:702 build/C/man7/pthreads.7:712 build/C/man7/pthreads.7:716 build/C/man7/pthreads.7:725 build/C/man7/pthreads.7:735 build/C/man7/pthreads.7:742 build/C/man7/pthreads.7:749 build/C/man7/pthreads.7:751 build/C/man7/pthreads.7:754 build/C/man7/pthreads.7:760 build/C/man7/pthreads.7:763 build/C/man7/pthreads.7:765 build/C/man7/pthreads.7:767 build/C/man7/pthreads.7:777 build/C/man7/pthreads.7:797 build/C/man7/pthreads.7:806 build/C/man7/pthreads.7:812 build/C/man7/pthreads.7:814 build/C/man7/pthreads.7:816 build/C/man7/pthreads.7:820 build/C/man7/pthreads.7:825 build/C/man7/pthreads.7:833
7292 #, no-wrap
7293 msgid "-"
7294 msgstr ""
7295
7296 #. type: Plain text
7297 #: build/C/man7/pthreads.7:41
7298 msgid "process ID"
7299 msgstr ""
7300
7301 #. type: Plain text
7302 #: build/C/man7/pthreads.7:43
7303 msgid "parent process ID"
7304 msgstr ""
7305
7306 #. type: Plain text
7307 #: build/C/man7/pthreads.7:45
7308 msgid "process group ID and session ID"
7309 msgstr ""
7310
7311 #. type: Plain text
7312 #: build/C/man7/pthreads.7:47
7313 msgid "controlling terminal"
7314 msgstr ""
7315
7316 #. type: Plain text
7317 #: build/C/man7/pthreads.7:49
7318 msgid "user and group IDs"
7319 msgstr ""
7320
7321 #. type: Plain text
7322 #: build/C/man7/pthreads.7:51
7323 msgid "open file descriptors"
7324 msgstr ""
7325
7326 #. type: Plain text
7327 #: build/C/man7/pthreads.7:54
7328 msgid "record locks (see B<fcntl>(2))"
7329 msgstr ""
7330
7331 #. type: Plain text
7332 #: build/C/man7/pthreads.7:56
7333 msgid "signal dispositions"
7334 msgstr ""
7335
7336 #. type: Plain text
7337 #: build/C/man7/pthreads.7:59
7338 msgid "file mode creation mask (B<umask>(2))"
7339 msgstr ""
7340
7341 #. type: Plain text
7342 #: build/C/man7/pthreads.7:65
7343 msgid "current directory (B<chdir>(2))  and root directory (B<chroot>(2))"
7344 msgstr ""
7345
7346 #. type: Plain text
7347 #: build/C/man7/pthreads.7:70
7348 msgid "interval timers (B<setitimer>(2))  and POSIX timers (B<timer_create>(2))"
7349 msgstr ""
7350
7351 #. type: Plain text
7352 #: build/C/man7/pthreads.7:73
7353 msgid "nice value (B<setpriority>(2))"
7354 msgstr ""
7355
7356 #. type: Plain text
7357 #: build/C/man7/pthreads.7:76
7358 msgid "resource limits (B<setrlimit>(2))"
7359 msgstr ""
7360
7361 #. type: Plain text
7362 #: build/C/man7/pthreads.7:81
7363 msgid ""
7364 "measurements of the consumption of CPU time (B<times>(2))  and resources "
7365 "(B<getrusage>(2))"
7366 msgstr ""
7367
7368 #. type: Plain text
7369 #: build/C/man7/pthreads.7:84
7370 msgid ""
7371 "As well as the stack, POSIX.1 specifies that various other attributes are "
7372 "distinct for each thread, including:"
7373 msgstr ""
7374
7375 #. type: Plain text
7376 #: build/C/man7/pthreads.7:88
7377 msgid "thread ID (the I<pthread_t> data type)"
7378 msgstr ""
7379
7380 #. type: Plain text
7381 #: build/C/man7/pthreads.7:91
7382 msgid "signal mask (B<pthread_sigmask>(3))"
7383 msgstr ""
7384
7385 #. type: Plain text
7386 #: build/C/man7/pthreads.7:95
7387 msgid "the I<errno> variable"
7388 msgstr ""
7389
7390 #. type: Plain text
7391 #: build/C/man7/pthreads.7:98
7392 msgid "alternate signal stack (B<sigaltstack>(2))"
7393 msgstr ""
7394
7395 #. type: Plain text
7396 #: build/C/man7/pthreads.7:101
7397 msgid "real-time scheduling policy and priority (B<sched>(7))"
7398 msgstr ""
7399
7400 #. type: Plain text
7401 #: build/C/man7/pthreads.7:103
7402 msgid "The following Linux-specific features are also per-thread:"
7403 msgstr ""
7404
7405 #. type: Plain text
7406 #: build/C/man7/pthreads.7:106
7407 msgid "capabilities (see B<capabilities>(7))"
7408 msgstr ""
7409
7410 #. type: Plain text
7411 #: build/C/man7/pthreads.7:109
7412 msgid "CPU affinity (B<sched_setaffinity>(2))"
7413 msgstr ""
7414
7415 #. type: SS
7416 #: build/C/man7/pthreads.7:109
7417 #, no-wrap
7418 msgid "Pthreads function return values"
7419 msgstr ""
7420
7421 #. type: Plain text
7422 #: build/C/man7/pthreads.7:116
7423 msgid ""
7424 "Most pthreads functions return 0 on success, and an error number of "
7425 "failure.  Note that the pthreads functions do not set I<errno>.  For each of "
7426 "the pthreads functions that can return an error, POSIX.1-2001 specifies that "
7427 "the function can never fail with the error B<EINTR>."
7428 msgstr ""
7429
7430 #. type: SS
7431 #: build/C/man7/pthreads.7:116
7432 #, no-wrap
7433 msgid "Thread IDs"
7434 msgstr ""
7435
7436 #. type: Plain text
7437 #: build/C/man7/pthreads.7:130
7438 msgid ""
7439 "Each of the threads in a process has a unique thread identifier (stored in "
7440 "the type I<pthread_t>).  This identifier is returned to the caller of "
7441 "B<pthread_create>(3), and a thread can obtain its own thread identifier "
7442 "using B<pthread_self>(3).  Thread IDs are guaranteed to be unique only "
7443 "within a process.  A thread ID may be reused after a terminated thread has "
7444 "been joined, or a detached thread has terminated.  In all pthreads functions "
7445 "that accept a thread ID as an argument, that ID by definition refers to a "
7446 "thread in the same process as the caller."
7447 msgstr ""
7448
7449 #. type: SS
7450 #: build/C/man7/pthreads.7:130
7451 #, no-wrap
7452 msgid "Thread-safe functions"
7453 msgstr ""
7454
7455 #. type: Plain text
7456 #: build/C/man7/pthreads.7:134
7457 msgid ""
7458 "A thread-safe function is one that can be safely (i.e., it will deliver the "
7459 "same results regardless of whether it is)  called from multiple threads at "
7460 "the same time."
7461 msgstr ""
7462
7463 #. type: Plain text
7464 #: build/C/man7/pthreads.7:138
7465 msgid ""
7466 "POSIX.1-2001 and POSIX.1-2008 require that all functions specified in the "
7467 "standard shall be thread-safe, except for the following functions:"
7468 msgstr ""
7469
7470 #. type: Plain text
7471 #: build/C/man7/pthreads.7:232
7472 #, no-wrap
7473 msgid ""
7474 "asctime()\n"
7475 "basename()\n"
7476 "catgets()\n"
7477 "crypt()\n"
7478 "ctermid() if passed a non-NULL argument\n"
7479 "ctime()\n"
7480 "dbm_clearerr()\n"
7481 "dbm_close()\n"
7482 "dbm_delete()\n"
7483 "dbm_error()\n"
7484 "dbm_fetch()\n"
7485 "dbm_firstkey()\n"
7486 "dbm_nextkey()\n"
7487 "dbm_open()\n"
7488 "dbm_store()\n"
7489 "dirname()\n"
7490 "dlerror()\n"
7491 "drand48()\n"
7492 "ecvt() [POSIX.1-2001 only (function removed in POSIX.1-2008)]\n"
7493 "encrypt()\n"
7494 "endgrent()\n"
7495 "endpwent()\n"
7496 "endutxent()\n"
7497 "fcvt() [POSIX.1-2001 only (function removed in POSIX.1-2008)]\n"
7498 "ftw()\n"
7499 "gcvt() [POSIX.1-2001 only (function removed in POSIX.1-2008)]\n"
7500 "getc_unlocked()\n"
7501 "getchar_unlocked()\n"
7502 "getdate()\n"
7503 "getenv()\n"
7504 "getgrent()\n"
7505 "getgrgid()\n"
7506 "getgrnam()\n"
7507 "gethostbyaddr() [POSIX.1-2001 only (function removed in POSIX.1-2008)]\n"
7508 "gethostbyname() [POSIX.1-2001 only (function removed in POSIX.1-2008)]\n"
7509 "gethostent()\n"
7510 "getlogin()\n"
7511 "getnetbyaddr()\n"
7512 "getnetbyname()\n"
7513 "getnetent()\n"
7514 "getopt()\n"
7515 "getprotobyname()\n"
7516 "getprotobynumber()\n"
7517 "getprotoent()\n"
7518 "getpwent()\n"
7519 "getpwnam()\n"
7520 "getpwuid()\n"
7521 "getservbyname()\n"
7522 "getservbyport()\n"
7523 "getservent()\n"
7524 "getutxent()\n"
7525 "getutxid()\n"
7526 "getutxline()\n"
7527 "gmtime()\n"
7528 "hcreate()\n"
7529 "hdestroy()\n"
7530 "hsearch()\n"
7531 "inet_ntoa()\n"
7532 "l64a()\n"
7533 "lgamma()\n"
7534 "lgammaf()\n"
7535 "lgammal()\n"
7536 "localeconv()\n"
7537 "localtime()\n"
7538 "lrand48()\n"
7539 "mrand48()\n"
7540 "nftw()\n"
7541 "nl_langinfo()\n"
7542 "ptsname()\n"
7543 "putc_unlocked()\n"
7544 "putchar_unlocked()\n"
7545 "putenv()\n"
7546 "pututxline()\n"
7547 "rand()\n"
7548 "readdir()\n"
7549 "setenv()\n"
7550 "setgrent()\n"
7551 "setkey()\n"
7552 "setpwent()\n"
7553 "setutxent()\n"
7554 "strerror()\n"
7555 "strsignal() [Added in POSIX.1-2008]\n"
7556 "strtok()\n"
7557 "system() [Added in POSIX.1-2008]\n"
7558 "tmpnam() if passed a non-NULL argument\n"
7559 "ttyname()\n"
7560 "unsetenv()\n"
7561 "wcrtomb() if its final argument is NULL\n"
7562 "wcsrtombs() if its final argument is NULL\n"
7563 "wcstombs()\n"
7564 "wctomb()\n"
7565 msgstr ""
7566
7567 #. type: SS
7568 #: build/C/man7/pthreads.7:234
7569 #, no-wrap
7570 msgid "Async-cancel-safe functions"
7571 msgstr ""
7572
7573 #. type: Plain text
7574 #: build/C/man7/pthreads.7:238
7575 msgid ""
7576 "An async-cancel-safe function is one that can be safely called in an "
7577 "application where asynchronous cancelability is enabled (see "
7578 "B<pthread_setcancelstate>(3))."
7579 msgstr ""
7580
7581 #. type: Plain text
7582 #: build/C/man7/pthreads.7:241
7583 msgid ""
7584 "Only the following functions are required to be async-cancel-safe by "
7585 "POSIX.1-2001 and POSIX.1-2008:"
7586 msgstr ""
7587
7588 #. type: Plain text
7589 #: build/C/man7/pthreads.7:247
7590 #, no-wrap
7591 msgid ""
7592 "pthread_cancel()\n"
7593 "pthread_setcancelstate()\n"
7594 "pthread_setcanceltype()\n"
7595 msgstr ""
7596
7597 #. type: SS
7598 #: build/C/man7/pthreads.7:249
7599 #, no-wrap
7600 msgid "Cancellation points"
7601 msgstr ""
7602
7603 #. type: Plain text
7604 #: build/C/man7/pthreads.7:256
7605 msgid ""
7606 "POSIX.1 specifies that certain functions must, and certain other functions "
7607 "may, be cancellation points.  If a thread is cancelable, its cancelability "
7608 "type is deferred, and a cancellation request is pending for the thread, then "
7609 "the thread is canceled when it calls a function that is a cancellation "
7610 "point."
7611 msgstr ""
7612
7613 #. type: Plain text
7614 #: build/C/man7/pthreads.7:259
7615 msgid ""
7616 "The following functions are required to be cancellation points by "
7617 "POSIX.1-2001 and/or POSIX.1-2008:"
7618 msgstr ""
7619
7620 #. type: Plain text
7621 #: build/C/man7/pthreads.7:322
7622 #, no-wrap
7623 msgid ""
7624 "accept()\n"
7625 "aio_suspend()\n"
7626 "clock_nanosleep()\n"
7627 "close()\n"
7628 "connect()\n"
7629 "creat()\n"
7630 "fcntl() F_SETLKW\n"
7631 "fdatasync()\n"
7632 "fsync()\n"
7633 "getmsg()\n"
7634 "getpmsg()\n"
7635 "lockf() F_LOCK\n"
7636 "mq_receive()\n"
7637 "mq_send()\n"
7638 "mq_timedreceive()\n"
7639 "mq_timedsend()\n"
7640 "msgrcv()\n"
7641 "msgsnd()\n"
7642 "msync()\n"
7643 "nanosleep()\n"
7644 "open()\n"
7645 "openat() [Added in POSIX.1-2008]\n"
7646 "pause()\n"
7647 "poll()\n"
7648 "pread()\n"
7649 "pselect()\n"
7650 "pthread_cond_timedwait()\n"
7651 "pthread_cond_wait()\n"
7652 "pthread_join()\n"
7653 "pthread_testcancel()\n"
7654 "putmsg()\n"
7655 "putpmsg()\n"
7656 "pwrite()\n"
7657 "read()\n"
7658 "readv()\n"
7659 "recv()\n"
7660 "recvfrom()\n"
7661 "recvmsg()\n"
7662 "select()\n"
7663 "sem_timedwait()\n"
7664 "sem_wait()\n"
7665 "send()\n"
7666 "sendmsg()\n"
7667 "sendto()\n"
7668 "sigpause() [POSIX.1-2001 only (moves to \"may\" list in POSIX.1-2008)]\n"
7669 "sigsuspend()\n"
7670 "sigtimedwait()\n"
7671 "sigwait()\n"
7672 "sigwaitinfo()\n"
7673 "sleep()\n"
7674 "system()\n"
7675 "tcdrain()\n"
7676 "usleep() [POSIX.1-2001 only (function removed in POSIX.1-2008)]\n"
7677 "wait()\n"
7678 "waitid()\n"
7679 "waitpid()\n"
7680 "write()\n"
7681 "writev()\n"
7682 msgstr ""
7683
7684 #. type: Plain text
7685 #: build/C/man7/pthreads.7:327
7686 msgid ""
7687 "The following functions may be cancellation points according to POSIX.1-2001 "
7688 "and/or POSIX.1-2008:"
7689 msgstr ""
7690
7691 #. type: Plain text
7692 #: build/C/man7/pthreads.7:555
7693 #, no-wrap
7694 msgid ""
7695 "access()\n"
7696 "asctime()\n"
7697 "asctime_r()\n"
7698 "catclose()\n"
7699 "catgets()\n"
7700 "catopen()\n"
7701 "chmod() [Added in POSIX.1-2008]\n"
7702 "chown() [Added in POSIX.1-2008]\n"
7703 "closedir()\n"
7704 "closelog()\n"
7705 "ctermid()\n"
7706 "ctime()\n"
7707 "ctime_r()\n"
7708 "dbm_close()\n"
7709 "dbm_delete()\n"
7710 "dbm_fetch()\n"
7711 "dbm_nextkey()\n"
7712 "dbm_open()\n"
7713 "dbm_store()\n"
7714 "dlclose()\n"
7715 "dlopen()\n"
7716 "dprintf() [Added in POSIX.1-2008]\n"
7717 "endgrent()\n"
7718 "endhostent()\n"
7719 "endnetent()\n"
7720 "endprotoent()\n"
7721 "endpwent()\n"
7722 "endservent()\n"
7723 "endutxent()\n"
7724 "faccessat() [Added in POSIX.1-2008]\n"
7725 "fchmod() [Added in POSIX.1-2008]\n"
7726 "fchmodat() [Added in POSIX.1-2008]\n"
7727 "fchown() [Added in POSIX.1-2008]\n"
7728 "fchownat() [Added in POSIX.1-2008]\n"
7729 "fclose()\n"
7730 "fcntl() (for any value of cmd argument)\n"
7731 "fflush()\n"
7732 "fgetc()\n"
7733 "fgetpos()\n"
7734 "fgets()\n"
7735 "fgetwc()\n"
7736 "fgetws()\n"
7737 "fmtmsg()\n"
7738 "fopen()\n"
7739 "fpathconf()\n"
7740 "fprintf()\n"
7741 "fputc()\n"
7742 "fputs()\n"
7743 "fputwc()\n"
7744 "fputws()\n"
7745 "fread()\n"
7746 "freopen()\n"
7747 "fscanf()\n"
7748 "fseek()\n"
7749 "fseeko()\n"
7750 "fsetpos()\n"
7751 "fstat()\n"
7752 "fstatat() [Added in POSIX.1-2008]\n"
7753 "ftell()\n"
7754 "ftello()\n"
7755 "ftw()\n"
7756 "futimens() [Added in POSIX.1-2008]\n"
7757 "fwprintf()\n"
7758 "fwrite()\n"
7759 "fwscanf()\n"
7760 "getaddrinfo()\n"
7761 "getc()\n"
7762 "getc_unlocked()\n"
7763 "getchar()\n"
7764 "getchar_unlocked()\n"
7765 "getcwd()\n"
7766 "getdate()\n"
7767 "getdelim() [Added in POSIX.1-2008]\n"
7768 "getgrent()\n"
7769 "getgrgid()\n"
7770 "getgrgid_r()\n"
7771 "getgrnam()\n"
7772 "getgrnam_r()\n"
7773 "gethostbyaddr() [SUSv3 only (function removed in POSIX.1-2008)]\n"
7774 "gethostbyname() [SUSv3 only (function removed in POSIX.1-2008)]\n"
7775 "gethostent()\n"
7776 "gethostid()\n"
7777 "gethostname()\n"
7778 "getline() [Added in POSIX.1-2008]\n"
7779 "getlogin()\n"
7780 "getlogin_r()\n"
7781 "getnameinfo()\n"
7782 "getnetbyaddr()\n"
7783 "getnetbyname()\n"
7784 "getnetent()\n"
7785 "getopt() (if opterr is nonzero)\n"
7786 "getprotobyname()\n"
7787 "getprotobynumber()\n"
7788 "getprotoent()\n"
7789 "getpwent()\n"
7790 "getpwnam()\n"
7791 "getpwnam_r()\n"
7792 "getpwuid()\n"
7793 "getpwuid_r()\n"
7794 "gets()\n"
7795 "getservbyname()\n"
7796 "getservbyport()\n"
7797 "getservent()\n"
7798 "getutxent()\n"
7799 "getutxid()\n"
7800 "getutxline()\n"
7801 "getwc()\n"
7802 "getwchar()\n"
7803 "getwd() [SUSv3 only (function removed in POSIX.1-2008)]\n"
7804 "glob()\n"
7805 "iconv_close()\n"
7806 "iconv_open()\n"
7807 "ioctl()\n"
7808 "link()\n"
7809 "linkat() [Added in POSIX.1-2008]\n"
7810 "lio_listio() [Added in POSIX.1-2008]\n"
7811 "localtime()\n"
7812 "localtime_r()\n"
7813 "lockf() [Added in POSIX.1-2008]\n"
7814 "lseek()\n"
7815 "lstat()\n"
7816 "mkdir() [Added in POSIX.1-2008]\n"
7817 "mkdirat() [Added in POSIX.1-2008]\n"
7818 "mkdtemp() [Added in POSIX.1-2008]\n"
7819 "mkfifo() [Added in POSIX.1-2008]\n"
7820 "mkfifoat() [Added in POSIX.1-2008]\n"
7821 "mknod() [Added in POSIX.1-2008]\n"
7822 "mknodat() [Added in POSIX.1-2008]\n"
7823 "mkstemp()\n"
7824 "mktime()\n"
7825 "nftw()\n"
7826 "opendir()\n"
7827 "openlog()\n"
7828 "pathconf()\n"
7829 "pclose()\n"
7830 "perror()\n"
7831 "popen()\n"
7832 "posix_fadvise()\n"
7833 "posix_fallocate()\n"
7834 "posix_madvise()\n"
7835 "posix_openpt()\n"
7836 "posix_spawn()\n"
7837 "posix_spawnp()\n"
7838 "posix_trace_clear()\n"
7839 "posix_trace_close()\n"
7840 "posix_trace_create()\n"
7841 "posix_trace_create_withlog()\n"
7842 "posix_trace_eventtypelist_getnext_id()\n"
7843 "posix_trace_eventtypelist_rewind()\n"
7844 "posix_trace_flush()\n"
7845 "posix_trace_get_attr()\n"
7846 "posix_trace_get_filter()\n"
7847 "posix_trace_get_status()\n"
7848 "posix_trace_getnext_event()\n"
7849 "posix_trace_open()\n"
7850 "posix_trace_rewind()\n"
7851 "posix_trace_set_filter()\n"
7852 "posix_trace_shutdown()\n"
7853 "posix_trace_timedgetnext_event()\n"
7854 "posix_typed_mem_open()\n"
7855 "printf()\n"
7856 "psiginfo() [Added in POSIX.1-2008]\n"
7857 "psignal() [Added in POSIX.1-2008]\n"
7858 "pthread_rwlock_rdlock()\n"
7859 "pthread_rwlock_timedrdlock()\n"
7860 "pthread_rwlock_timedwrlock()\n"
7861 "pthread_rwlock_wrlock()\n"
7862 "putc()\n"
7863 "putc_unlocked()\n"
7864 "putchar()\n"
7865 "putchar_unlocked()\n"
7866 "puts()\n"
7867 "pututxline()\n"
7868 "putwc()\n"
7869 "putwchar()\n"
7870 "readdir()\n"
7871 "readdir_r()\n"
7872 "readlink() [Added in POSIX.1-2008]\n"
7873 "readlinkat() [Added in POSIX.1-2008]\n"
7874 "remove()\n"
7875 "rename()\n"
7876 "renameat() [Added in POSIX.1-2008]\n"
7877 "rewind()\n"
7878 "rewinddir()\n"
7879 "scandir() [Added in POSIX.1-2008]\n"
7880 "scanf()\n"
7881 "seekdir()\n"
7882 "semop()\n"
7883 "setgrent()\n"
7884 "sethostent()\n"
7885 "setnetent()\n"
7886 "setprotoent()\n"
7887 "setpwent()\n"
7888 "setservent()\n"
7889 "setutxent()\n"
7890 "sigpause() [Added in POSIX.1-2008]\n"
7891 "stat()\n"
7892 "strerror()\n"
7893 "strerror_r()\n"
7894 "strftime()\n"
7895 "symlink()\n"
7896 "symlinkat() [Added in POSIX.1-2008]\n"
7897 "sync()\n"
7898 "syslog()\n"
7899 "tmpfile()\n"
7900 "tmpnam()\n"
7901 "ttyname()\n"
7902 "ttyname_r()\n"
7903 "tzset()\n"
7904 "ungetc()\n"
7905 "ungetwc()\n"
7906 "unlink()\n"
7907 "unlinkat() [Added in POSIX.1-2008]\n"
7908 "utime() [Added in POSIX.1-2008]\n"
7909 "utimensat() [Added in POSIX.1-2008]\n"
7910 "utimes() [Added in POSIX.1-2008]\n"
7911 "vdprintf() [Added in POSIX.1-2008]\n"
7912 "vfprintf()\n"
7913 "vfwprintf()\n"
7914 "vprintf()\n"
7915 "vwprintf()\n"
7916 "wcsftime()\n"
7917 "wordexp()\n"
7918 "wprintf()\n"
7919 "wscanf()\n"
7920 msgstr ""
7921
7922 #.  So, scanning "cancellation point" comments in the glibc 2.8 header
7923 #.  files, it looks as though at least the following nonstandard
7924 #.  functions are cancellation points:
7925 #.  endnetgrent
7926 #.  endspent
7927 #.  epoll_pwait
7928 #.  epoll_wait
7929 #.  fcloseall
7930 #.  fdopendir
7931 #.  fflush_unlocked
7932 #.  fgetc_unlocked
7933 #.  fgetgrent
7934 #.  fgetgrent_r
7935 #.  fgetpwent
7936 #.  fgetpwent_r
7937 #.  fgets_unlocked
7938 #.  fgetspent
7939 #.  fgetspent_r
7940 #.  fgetwc_unlocked
7941 #.  fgetws_unlocked
7942 #.  fputc_unlocked
7943 #.  fputs_unlocked
7944 #.  fputwc_unlocked
7945 #.  fputws_unlocked
7946 #.  fread_unlocked
7947 #.  fwrite_unlocked
7948 #.  gai_suspend
7949 #.  getaddrinfo_a
7950 #.  getdate_r
7951 #.  getgrent_r
7952 #.  getgrouplist
7953 #.  gethostbyaddr_r
7954 #.  gethostbyname2
7955 #.  gethostbyname2_r
7956 #.  gethostbyname_r
7957 #.  gethostent_r
7958 #.  getnetbyaddr_r
7959 #.  getnetbyname_r
7960 #.  getnetent_r
7961 #.  getnetgrent
7962 #.  getnetgrent_r
7963 #.  getprotobyname_r
7964 #.  getprotobynumber_r
7965 #.  getprotoent_r
7966 #.  getpw
7967 #.  getpwent_r
7968 #.  getservbyname_r
7969 #.  getservbyport_r
7970 #.  getservent_r
7971 #.  getspent
7972 #.  getspent_r
7973 #.  getspnam
7974 #.  getspnam_r
7975 #.  getutmp
7976 #.  getutmpx
7977 #.  getw
7978 #.  getwc_unlocked
7979 #.  getwchar_unlocked
7980 #.  initgroups
7981 #.  innetgr
7982 #.  mkostemp
7983 #.  mkostemp64
7984 #.  mkstemp64
7985 #.  ppoll
7986 #.  pthread_timedjoin_np
7987 #.  putgrent
7988 #.  putpwent
7989 #.  putspent
7990 #.  putw
7991 #.  putwc_unlocked
7992 #.  putwchar_unlocked
7993 #.  rcmd
7994 #.  rcmd_af
7995 #.  rexec
7996 #.  rexec_af
7997 #.  rresvport
7998 #.  rresvport_af
7999 #.  ruserok
8000 #.  ruserok_af
8001 #.  setnetgrent
8002 #.  setspent
8003 #.  sgetspent
8004 #.  sgetspent_r
8005 #.  updwtmpx
8006 #.  utmpxname
8007 #.  vfscanf
8008 #.  vfwscanf
8009 #.  vscanf
8010 #.  vsyslog
8011 #.  vwscanf
8012 #. type: Plain text
8013 #: build/C/man7/pthreads.7:653
8014 msgid ""
8015 "An implementation may also mark other functions not specified in the "
8016 "standard as cancellation points.  In particular, an implementation is likely "
8017 "to mark any nonstandard function that may block as a cancellation point.  "
8018 "(This includes most functions that can touch files.)"
8019 msgstr ""
8020
8021 #. type: SS
8022 #: build/C/man7/pthreads.7:653
8023 #, no-wrap
8024 msgid "Compiling on Linux"
8025 msgstr ""
8026
8027 #. type: Plain text
8028 #: build/C/man7/pthreads.7:656
8029 msgid ""
8030 "On Linux, programs that use the Pthreads API should be compiled using I<cc "
8031 "-pthread>."
8032 msgstr ""
8033
8034 #. type: SS
8035 #: build/C/man7/pthreads.7:656
8036 #, no-wrap
8037 msgid "Linux implementations of POSIX threads"
8038 msgstr ""
8039
8040 #. type: Plain text
8041 #: build/C/man7/pthreads.7:659
8042 msgid ""
8043 "Over time, two threading implementations have been provided by the GNU C "
8044 "library on Linux:"
8045 msgstr ""
8046
8047 #. type: TP
8048 #: build/C/man7/pthreads.7:659
8049 #, no-wrap
8050 msgid "B<LinuxThreads>"
8051 msgstr ""
8052
8053 #. type: Plain text
8054 #: build/C/man7/pthreads.7:663
8055 msgid ""
8056 "This is the original Pthreads implementation.  Since glibc 2.4, this "
8057 "implementation is no longer supported."
8058 msgstr ""
8059
8060 #. type: TP
8061 #: build/C/man7/pthreads.7:663
8062 #, no-wrap
8063 msgid "B<NPTL> (Native POSIX Threads Library)"
8064 msgstr ""
8065
8066 #. type: Plain text
8067 #: build/C/man7/pthreads.7:671
8068 msgid ""
8069 "This is the modern Pthreads implementation.  By comparison with "
8070 "LinuxThreads, NPTL provides closer conformance to the requirements of the "
8071 "POSIX.1 specification and better performance when creating large numbers of "
8072 "threads.  NPTL is available since glibc 2.3.2, and requires features that "
8073 "are present in the Linux 2.6 kernel."
8074 msgstr ""
8075
8076 #. type: Plain text
8077 #: build/C/man7/pthreads.7:681
8078 msgid ""
8079 "Both of these are so-called 1:1 implementations, meaning that each thread "
8080 "maps to a kernel scheduling entity.  Both threading implementations employ "
8081 "the Linux B<clone>(2)  system call.  In NPTL, thread synchronization "
8082 "primitives (mutexes, thread joining, and so on) are implemented using the "
8083 "Linux B<futex>(2)  system call."
8084 msgstr ""
8085
8086 #. type: SS
8087 #: build/C/man7/pthreads.7:681
8088 #, no-wrap
8089 msgid "LinuxThreads"
8090 msgstr ""
8091
8092 #. type: Plain text
8093 #: build/C/man7/pthreads.7:683
8094 msgid "The notable features of this implementation are the following:"
8095 msgstr ""
8096
8097 #. type: Plain text
8098 #: build/C/man7/pthreads.7:690
8099 msgid ""
8100 "In addition to the main (initial) thread, and the threads that the program "
8101 "creates using B<pthread_create>(3), the implementation creates a \"manager\" "
8102 "thread.  This thread handles thread creation and termination.  (Problems can "
8103 "result if this thread is inadvertently killed.)"
8104 msgstr ""
8105
8106 #. type: Plain text
8107 #: build/C/man7/pthreads.7:702
8108 msgid ""
8109 "Signals are used internally by the implementation.  On Linux 2.2 and later, "
8110 "the first three real-time signals are used (see also B<signal>(7)).  On "
8111 "older Linux kernels, B<SIGUSR1> and B<SIGUSR2> are used.  Applications must "
8112 "avoid the use of whichever set of signals is employed by the implementation."
8113 msgstr ""
8114
8115 #. type: Plain text
8116 #: build/C/man7/pthreads.7:709
8117 msgid ""
8118 "Threads do not share process IDs.  (In effect, LinuxThreads threads are "
8119 "implemented as processes which share more information than usual, but which "
8120 "do not share a common process ID.)  LinuxThreads threads (including the "
8121 "manager thread)  are visible as separate processes using B<ps>(1)."
8122 msgstr ""
8123
8124 #. type: Plain text
8125 #: build/C/man7/pthreads.7:712
8126 msgid ""
8127 "The LinuxThreads implementation deviates from the POSIX.1 specification in a "
8128 "number of ways, including the following:"
8129 msgstr ""
8130
8131 #. type: Plain text
8132 #: build/C/man7/pthreads.7:716
8133 msgid "Calls to B<getpid>(2)  return a different value in each thread."
8134 msgstr ""
8135
8136 #. type: Plain text
8137 #: build/C/man7/pthreads.7:725
8138 msgid ""
8139 "Calls to B<getppid>(2)  in threads other than the main thread return the "
8140 "process ID of the manager thread; instead B<getppid>(2)  in these threads "
8141 "should return the same value as B<getppid>(2)  in the main thread."
8142 msgstr ""
8143
8144 #. type: Plain text
8145 #: build/C/man7/pthreads.7:735
8146 msgid ""
8147 "When one thread creates a new child process using B<fork>(2), any thread "
8148 "should be able to B<wait>(2)  on the child.  However, the implementation "
8149 "only allows the thread that created the child to B<wait>(2)  on it."
8150 msgstr ""
8151
8152 #. type: Plain text
8153 #: build/C/man7/pthreads.7:742
8154 msgid ""
8155 "When a thread calls B<execve>(2), all other threads are terminated (as "
8156 "required by POSIX.1).  However, the resulting process has the same PID as "
8157 "the thread that called B<execve>(2): it should have the same PID as the main "
8158 "thread."
8159 msgstr ""
8160
8161 #. type: Plain text
8162 #: build/C/man7/pthreads.7:749
8163 msgid ""
8164 "Threads do not share user and group IDs.  This can cause complications with "
8165 "set-user-ID programs and can cause failures in Pthreads functions if an "
8166 "application changes its credentials using B<seteuid>(2)  or similar."
8167 msgstr ""
8168
8169 #. type: Plain text
8170 #: build/C/man7/pthreads.7:751
8171 msgid "Threads do not share a common session ID and process group ID."
8172 msgstr ""
8173
8174 #. type: Plain text
8175 #: build/C/man7/pthreads.7:754
8176 msgid "Threads do not share record locks created using B<fcntl>(2)."
8177 msgstr ""
8178
8179 #. type: Plain text
8180 #: build/C/man7/pthreads.7:760
8181 msgid ""
8182 "The information returned by B<times>(2)  and B<getrusage>(2)  is per-thread "
8183 "rather than process-wide."
8184 msgstr ""
8185
8186 #. type: Plain text
8187 #: build/C/man7/pthreads.7:763
8188 msgid "Threads do not share semaphore undo values (see B<semop>(2))."
8189 msgstr ""
8190
8191 #. type: Plain text
8192 #: build/C/man7/pthreads.7:765
8193 msgid "Threads do not share interval timers."
8194 msgstr ""
8195
8196 #.  FIXME . bug report filed for NPTL nice nonconformance
8197 #.  http://bugzilla.kernel.org/show_bug.cgi?id=6258
8198 #.  Sep 08: there is a patch by Denys Vlasenko to address this
8199 #.  "make setpriority POSIX compliant; introduce PRIO_THREAD extension"
8200 #.  Monitor this to see if it makes it into mainline.
8201 #. type: Plain text
8202 #: build/C/man7/pthreads.7:767 build/C/man7/pthreads.7:804
8203 msgid "Threads do not share a common nice value."
8204 msgstr ""
8205
8206 #. type: Plain text
8207 #: build/C/man7/pthreads.7:777
8208 msgid ""
8209 "POSIX.1 distinguishes the notions of signals that are directed to the "
8210 "process as a whole and signals that are directed to individual threads.  "
8211 "According to POSIX.1, a process-directed signal (sent using B<kill>(2), for "
8212 "example) should be handled by a single, arbitrarily selected thread within "
8213 "the process.  LinuxThreads does not support the notion of process-directed "
8214 "signals: signals may be sent only to specific threads."
8215 msgstr ""
8216
8217 #. type: Plain text
8218 #: build/C/man7/pthreads.7:786
8219 msgid ""
8220 "Threads have distinct alternate signal stack settings.  However, a new "
8221 "thread's alternate signal stack settings are copied from the thread that "
8222 "created it, so that the threads initially share an alternate signal stack.  "
8223 "(A new thread should start with no alternate signal stack defined.  If two "
8224 "threads handle signals on their shared alternate signal stack at the same "
8225 "time, unpredictable program failures are likely to occur.)"
8226 msgstr ""
8227
8228 #. type: SS
8229 #: build/C/man7/pthreads.7:786
8230 #, no-wrap
8231 msgid "NPTL"
8232 msgstr ""
8233
8234 #. type: Plain text
8235 #: build/C/man7/pthreads.7:795
8236 msgid ""
8237 "With NPTL, all of the threads in a process are placed in the same thread "
8238 "group; all members of a thread group share the same PID.  NPTL does not "
8239 "employ a manager thread.  NPTL makes internal use of the first two real-time "
8240 "signals (see also B<signal>(7)); these signals cannot be used in "
8241 "applications."
8242 msgstr ""
8243
8244 #. type: Plain text
8245 #: build/C/man7/pthreads.7:797
8246 msgid "NPTL still has at least one nonconformance with POSIX.1:"
8247 msgstr ""
8248
8249 #. type: Plain text
8250 #: build/C/man7/pthreads.7:806
8251 msgid "Some NPTL nonconformances occur only with older kernels:"
8252 msgstr ""
8253
8254 #. type: Plain text
8255 #: build/C/man7/pthreads.7:812
8256 msgid ""
8257 "The information returned by B<times>(2)  and B<getrusage>(2)  is per-thread "
8258 "rather than process-wide (fixed in kernel 2.6.9)."
8259 msgstr ""
8260
8261 #. type: Plain text
8262 #: build/C/man7/pthreads.7:814
8263 msgid "Threads do not share resource limits (fixed in kernel 2.6.10)."
8264 msgstr ""
8265
8266 #. type: Plain text
8267 #: build/C/man7/pthreads.7:816
8268 msgid "Threads do not share interval timers (fixed in kernel 2.6.12)."
8269 msgstr ""
8270
8271 #. type: Plain text
8272 #: build/C/man7/pthreads.7:820
8273 msgid ""
8274 "Only the main thread is permitted to start a new session using B<setsid>(2)  "
8275 "(fixed in kernel 2.6.16)."
8276 msgstr ""
8277
8278 #. type: Plain text
8279 #: build/C/man7/pthreads.7:825
8280 msgid ""
8281 "Only the main thread is permitted to make the process into a process group "
8282 "leader using B<setpgid>(2)  (fixed in kernel 2.6.16)."
8283 msgstr ""
8284
8285 #. type: Plain text
8286 #: build/C/man7/pthreads.7:831
8287 msgid ""
8288 "Threads have distinct alternate signal stack settings.  However, a new "
8289 "thread's alternate signal stack settings are copied from the thread that "
8290 "created it, so that the threads initially share an alternate signal stack "
8291 "(fixed in kernel 2.6.16)."
8292 msgstr ""
8293
8294 #. type: Plain text
8295 #: build/C/man7/pthreads.7:833
8296 msgid "Note the following further points about the NPTL implementation:"
8297 msgstr ""
8298
8299 #. type: Plain text
8300 #: build/C/man7/pthreads.7:847
8301 msgid ""
8302 "If the stack size soft resource limit (see the description of "
8303 "B<RLIMIT_STACK> in B<setrlimit>(2))  is set to a value other than "
8304 "I<unlimited>, then this value defines the default stack size for new "
8305 "threads.  To be effective, this limit must be set before the program is "
8306 "executed, perhaps using the I<ulimit -s> shell built-in command (I<limit "
8307 "stacksize> in the C shell)."
8308 msgstr ""
8309
8310 #. type: SS
8311 #: build/C/man7/pthreads.7:847
8312 #, no-wrap
8313 msgid "Determining the threading implementation"
8314 msgstr ""
8315
8316 #. type: Plain text
8317 #: build/C/man7/pthreads.7:852
8318 msgid ""
8319 "Since glibc 2.3.2, the B<getconf>(1)  command can be used to determine the "
8320 "system's threading implementation, for example:"
8321 msgstr ""
8322
8323 #. type: Plain text
8324 #: build/C/man7/pthreads.7:857
8325 #, no-wrap
8326 msgid ""
8327 "bash$ getconf GNU_LIBPTHREAD_VERSION\n"
8328 "NPTL 2.3.4\n"
8329 msgstr ""
8330
8331 #. type: Plain text
8332 #: build/C/man7/pthreads.7:862
8333 msgid ""
8334 "With older glibc versions, a command such as the following should be "
8335 "sufficient to determine the default threading implementation:"
8336 msgstr ""
8337
8338 #. type: Plain text
8339 #: build/C/man7/pthreads.7:868
8340 #, no-wrap
8341 msgid ""
8342 "bash$ $( ldd /bin/ls | grep libc.so | awk \\(aq{print $3}\\(aq ) | \\e\n"
8343 "                egrep -i \\(aqthreads|nptl\\(aq\n"
8344 "        Native POSIX Threads Library by Ulrich Drepper et al\n"
8345 msgstr ""
8346
8347 #. type: SS
8348 #: build/C/man7/pthreads.7:870
8349 #, no-wrap
8350 msgid "Selecting the threading implementation: LD_ASSUME_KERNEL"
8351 msgstr ""
8352
8353 #. type: Plain text
8354 #: build/C/man7/pthreads.7:885
8355 msgid ""
8356 "On systems with a glibc that supports both LinuxThreads and NPTL (i.e., "
8357 "glibc 2.3.I<x>), the B<LD_ASSUME_KERNEL> environment variable can be used to "
8358 "override the dynamic linker's default choice of threading implementation.  "
8359 "This variable tells the dynamic linker to assume that it is running on top "
8360 "of a particular kernel version.  By specifying a kernel version that does "
8361 "not provide the support required by NPTL, we can force the use of "
8362 "LinuxThreads.  (The most likely reason for doing this is to run a (broken) "
8363 "application that depends on some nonconformant behavior in LinuxThreads.)  "
8364 "For example:"
8365 msgstr ""
8366
8367 #. type: Plain text
8368 #: build/C/man7/pthreads.7:891
8369 #, no-wrap
8370 msgid ""
8371 "bash$ $( LD_ASSUME_KERNEL=2.2.5 ldd /bin/ls | grep libc.so | \\e\n"
8372 "                awk \\(aq{print $3}\\(aq ) | egrep -i "
8373 "\\(aqthreads|nptl\\(aq\n"
8374 "        linuxthreads-0.10 by Xavier Leroy\n"
8375 msgstr ""
8376
8377 #. type: Plain text
8378 #: build/C/man7/pthreads.7:903
8379 msgid ""
8380 "B<clone>(2), B<futex>(2), B<gettid>(2), B<proc>(5), B<futex>(7), "
8381 "B<sigevent>(7), B<signal>(7),"
8382 msgstr ""
8383
8384 #. type: Plain text
8385 #: build/C/man7/pthreads.7:926
8386 msgid ""
8387 "Various Pthreads manual pages, for example: B<pthread_attr_init>(3), "
8388 "B<pthread_atfork>(3), B<pthread_cancel>(3), B<pthread_cleanup_push>(3), "
8389 "B<pthread_cond_signal>(3), B<pthread_cond_wait>(3), B<pthread_create>(3), "
8390 "B<pthread_detach>(3), B<pthread_equal>(3), B<pthread_exit>(3), "
8391 "B<pthread_key_create>(3), B<pthread_kill>(3), B<pthread_mutex_lock>(3), "
8392 "B<pthread_mutex_unlock>(3), B<pthread_once>(3), "
8393 "B<pthread_setcancelstate>(3), B<pthread_setcanceltype>(3), "
8394 "B<pthread_setspecific>(3), B<pthread_sigmask>(3), B<pthread_sigqueue>(3), "
8395 "and B<pthread_testcancel>(3)"
8396 msgstr ""