OSDN Git Service

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