OSDN Git Service

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