OSDN Git Service

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