OSDN Git Service

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