OSDN Git Service

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