Debian Codegraph @

po/ru/man3/pthread_attr_init.3.po

raw
1 # Russian translation of manpages
2 # This file is distributed under the same license as the manpages-l10n package.
3 # Copyright © of this file:
4 # Alexey, 2016.
5 # Azamat Hackimov <[email protected]>, 2014-2017.
6 # kogamatranslator49 <[email protected]>, 2015.
7 # Darima Kogan <[email protected]>, 2014.
8 # Max Is <[email protected]>, 2016.
9 # Yuri Kozlov <[email protected]>, 2011-2019.
10 # Иван Павлов <[email protected]>, 2017.
11 msgid ""
12 msgstr ""
13 "Project-Id-Version: manpages-l10n\n"
14 "POT-Creation-Date: 2026-06-05 06:38+0200\n"
15 "PO-Revision-Date: 2024-12-21 19:50+0300\n"
16 "Last-Translator: Yuri Kozlov <[email protected]>\n"
17 "Language-Team: Russian <[email protected]>\n"
18 "Language: ru\n"
19 "MIME-Version: 1.0\n"
20 "Content-Type: text/plain; charset=UTF-8\n"
21 "Content-Transfer-Encoding: 8bit\n"
22 "Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
23 "n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || "
24 "(n%100>=11 && n%100<=14)? 2 : 3);\n"
25 "X-Generator: Lokalize 2.0\n"
26
27 #. type: TH
28 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
29 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
30 #, fuzzy, no-wrap
31 #| msgid "See B<pthread_attr_init>(3)."
32 msgid "pthread_attr_init"
33 msgstr "Смотрите B<pthread_attr_init>(3)."
34
35 #. type: TH
36 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
37 #: opensuse-tumbleweed
38 #, no-wrap
39 msgid "2025-09-21"
40 msgstr "21 сентября 2025 г."
41
42 #. type: TH
43 #: archlinux debian-unstable
44 #, fuzzy, no-wrap
45 #| msgid "Linux man-pages 6.17"
46 msgid "Linux man-pages 6.18"
47 msgstr "Справочные страницы Linux 6.17"
48
49 #. type: SH
50 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
51 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
52 #, no-wrap
53 msgid "NAME"
54 msgstr "НАИМЕНОВАНИЕ"
55
56 #. type: Plain text
57 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
58 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
59 msgid ""
60 "pthread_attr_init, pthread_attr_destroy - initialize and destroy thread "
61 "attributes object"
62 msgstr ""
63 "pthread_attr_init, pthread_attr_destroy - инициализирует и уничтожает объект "
64 "атрибутов нити"
65
66 #. type: SH
67 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
68 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
69 #, no-wrap
70 msgid "LIBRARY"
71 msgstr "БИБЛИОТЕКА"
72
73 #. type: Plain text
74 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
75 #: opensuse-leap-16-1 opensuse-tumbleweed
76 msgid "POSIX threads library (I<libpthread>,\\ I<-lpthread>)"
77 msgstr "Библиотека потоков POSIX (I<libpthread>,\\ I<-lpthread>)"
78
79 #. type: SH
80 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
81 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
82 #, no-wrap
83 msgid "SYNOPSIS"
84 msgstr "СИНТАКСИС"
85
86 #. type: Plain text
87 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
88 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
89 #, no-wrap
90 msgid "B<#include E<lt>pthread.hE<gt>>\n"
91 msgstr "B<#include E<lt>pthread.hE<gt>>\n"
92
93 #. type: Plain text
94 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
95 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
96 #, no-wrap
97 msgid ""
98 "B<int pthread_attr_init(pthread_attr_t *>I<attr>B<);>\n"
99 "B<int pthread_attr_destroy(pthread_attr_t *>I<attr>B<);>\n"
100 msgstr ""
101 "B<int pthread_attr_init(pthread_attr_t *>I<attr>B<);>\n"
102 "B<int pthread_attr_destroy(pthread_attr_t *>I<attr>B<);>\n"
103
104 #. type: SH
105 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
106 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
107 #, no-wrap
108 msgid "DESCRIPTION"
109 msgstr "ОПИСАНИЕ"
110
111 #. type: Plain text
112 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
113 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
114 msgid ""
115 "The B<pthread_attr_init>() function initializes the thread attributes "
116 "object pointed to by I<attr> with default attribute values. After this "
117 "call, individual attributes of the object can be set using various related "
118 "functions (listed under SEE ALSO), and then the object can be used in one or "
119 "more B<pthread_create>(3) calls that create threads."
120 msgstr ""
121 "Функция B<pthread_attr_init>() инициализирует объект атрибутов нити, на "
122 "который указывает I<attr>, значениями атрибутов по умолчанию. После этого "
123 "вызова отдельные атрибуты объекта можно изменять с помощью различных "
124 "соответствующих функций (перечислены в разделе СМОТРИТЕ ТАКЖЕ, а после этого "
125 "объект можно использовать в одном или нескольких вызовах "
126 "B<pthread_create>(3) для создания нитей."
127
128 #. type: Plain text
129 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
130 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
131 msgid ""
132 "Calling B<pthread_attr_init>() on a thread attributes object that has "
133 "already been initialized results in undefined behavior."
134 msgstr ""
135 "Вызов B<pthread_attr_init>() с уже инициализированным объектом атрибутов "
136 "нити приводит к непредсказуемому поведению."
137
138 #. type: Plain text
139 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
140 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
141 msgid ""
142 "When a thread attributes object is no longer required, it should be "
143 "destroyed using the B<pthread_attr_destroy>() function. Destroying a "
144 "thread attributes object has no effect on threads that were created using "
145 "that object."
146 msgstr ""
147 "Когда объект атрибутов нити больше не нужен, он должен быть уничтожен с "
148 "помощью функции B<pthread_attr_destroy>(). Уничтожение объекта атрибутов "
149 "нити не влияет на нить, которая была создана с использованием этого объекта."
150
151 #. type: Plain text
152 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
153 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
154 msgid ""
155 "Once a thread attributes object has been destroyed, it can be reinitialized "
156 "using B<pthread_attr_init>(). Any other use of a destroyed thread "
157 "attributes object has undefined results."
158 msgstr ""
159 "После уничтожения объекта атрибутов нити его можно инициализировать с "
160 "помощью B<pthread_attr_init>() повторно. При использовании уничтоженного "
161 "объекта атрибутов нити другим способом приводит непредсказуемым результатам."
162
163 #. type: SH
164 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
165 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
166 #, no-wrap
167 msgid "RETURN VALUE"
168 msgstr "ВОЗВРАЩАЕМОЕ ЗНАЧЕНИЕ"
169
170 #. type: Plain text
171 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
172 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
173 msgid ""
174 "On success, these functions return 0; on error, they return a nonzero error "
175 "number."
176 msgstr ""
177 "При успешном выполнении эти функции возвращают 0; при ошибке возвращается "
178 "ненулевой номер ошибки."
179
180 #. type: SH
181 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
182 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
183 #, no-wrap
184 msgid "ERRORS"
185 msgstr "ОШИБКИ"
186
187 #. type: Plain text
188 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
189 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
190 msgid ""
191 "POSIX.1 documents an B<ENOMEM> error for B<pthread_attr_init>(); on Linux "
192 "these functions always succeed (but portable and future-proof applications "
193 "should nevertheless handle a possible error return)."
194 msgstr ""
195 "В POSIX.1 описана ошибка B<ENOMEM> для B<pthread_attr_init>(); в Linux эти "
196 "функции всегда выполняются успешно (тем не менее, в переносимых приложениях "
197 "нужно учитывать возможность возврата ошибки)."
198
199 #. type: SH
200 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
201 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
202 #, no-wrap
203 msgid "ATTRIBUTES"
204 msgstr "АТРИБУТЫ"
205
206 #. type: Plain text
207 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
208 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
209 msgid ""
210 "For an explanation of the terms used in this section, see B<attributes>(7)."
211 msgstr "Описание терминов данного раздела смотрите в B<attributes>(7)."
212
213 #. type: tbl table
214 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
215 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
216 #, no-wrap
217 msgid "Interface"
218 msgstr "Интерфейс"
219
220 #. type: tbl table
221 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
222 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
223 #, no-wrap
224 msgid "Attribute"
225 msgstr "Атрибут"
226
227 #. type: tbl table
228 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
229 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
230 #, no-wrap
231 msgid "Value"
232 msgstr "Значение"
233
234 #. type: tbl table
235 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
236 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
237 #, no-wrap
238 msgid ".na\n"
239 msgstr ".na\n"
240
241 #. type: tbl table
242 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
243 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
244 #, no-wrap
245 msgid ".nh\n"
246 msgstr ".nh\n"
247
248 #. type: tbl table
249 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
250 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
251 #, no-wrap
252 msgid ""
253 "B<pthread_attr_init>(),\n"
254 "B<pthread_attr_destroy>()"
255 msgstr ""
256 "B<pthread_attr_init>(),\n"
257 "B<pthread_attr_destroy>()"
258
259 #. type: tbl table
260 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
261 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
262 #, no-wrap
263 msgid "Thread safety"
264 msgstr "Безвредность в нитях"
265
266 #. type: tbl table
267 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
268 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
269 #, no-wrap
270 msgid "MT-Safe"
271 msgstr "MT-Safe"
272
273 #. type: SH
274 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
275 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
276 #, no-wrap
277 msgid "STANDARDS"
278 msgstr "СТАНДАРТЫ"
279
280 #. type: Plain text
281 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
282 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
283 msgid "POSIX.1-2008."
284 msgstr "POSIX.1-2008."
285
286 #. type: SH
287 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
288 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
289 #, no-wrap
290 msgid "HISTORY"
291 msgstr "ИСТОРИЯ"
292
293 #. type: Plain text
294 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
295 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
296 msgid "POSIX.1-2001."
297 msgstr "POSIX.1-2001."
298
299 #. type: SH
300 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
301 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
302 #, no-wrap
303 msgid "NOTES"
304 msgstr "ПРИМЕЧАНИЯ"
305
306 #. type: Plain text
307 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
308 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
309 msgid ""
310 "The I<pthread_attr_t> type should be treated as opaque: any access to the "
311 "object other than via pthreads functions is nonportable and produces "
312 "undefined results."
313 msgstr ""
314 "Тип I<pthread_attr_t> должен считаться со скрытым форматом: любой доступ к "
315 "объекту помимо функций pthreads является непереносимым и приводит к "
316 "непредсказуемым результатам."
317
318 #. type: SH
319 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
320 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
321 #, no-wrap
322 msgid "EXAMPLES"
323 msgstr "ПРИМЕРЫ"
324
325 #. type: Plain text
326 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
327 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
328 msgid ""
329 "The program below optionally makes use of B<pthread_attr_init>() and "
330 "various related functions to initialize a thread attributes object that is "
331 "used to create a single thread. Once created, the thread uses the "
332 "B<pthread_getattr_np>(3) function (a nonstandard GNU extension) to retrieve "
333 "the thread's attributes, and then displays those attributes."
334 msgstr ""
335 "В программе, представленной ниже, для создания одной нити используется "
336 "B<pthread_attr_init>() и другие функции, относящиеся к инициализации объекта "
337 "атрибутов нити. После создания в нити используется функция "
338 "B<pthread_getattr_np>(3) (нестандартное расширение GNU) для получения "
339 "атрибутов нити, а затем показываются эти атрибуты."
340
341 #. type: Plain text
342 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
343 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
344 msgid ""
345 "If the program is run with no command-line argument, then it passes NULL as "
346 "the I<attr> argument of B<pthread_create>(3), so that the thread is created "
347 "with default attributes. Running the program on Linux/x86-32 with the NPTL "
348 "threading implementation, we see the following:"
349 msgstr ""
350 "Если программа запускается без аргументов командной строки, то аргумент "
351 "I<attr> функции B<pthread_create>(3) равен NULL, и поэтому нить создаётся с "
352 "атрибутами по умолчанию. При запуске программы на Linux/x86-32 с реализацией "
353 "нитей NPTL мы увидим следующее:"
354
355 #. Results from glibc 2.8, SUSE 11.0; Oct 2008
356 #. type: Plain text
357 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
358 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
359 #, no-wrap
360 msgid ""
361 "$B< ulimit -s> # No stack limit ==E<gt> default stack size is 2 MB\n"
362 "unlimited\n"
363 "$B< ./a.out>\n"
364 "Thread attributes:\n"
365 " Detach state = PTHREAD_CREATE_JOINABLE\n"
366 " Scope = PTHREAD_SCOPE_SYSTEM\n"
367 " Inherit scheduler = PTHREAD_INHERIT_SCHED\n"
368 " Scheduling policy = SCHED_OTHER\n"
369 " Scheduling priority = 0\n"
370 " Guard size = 4096 bytes\n"
371 " Stack address = 0x40196000\n"
372 " Stack size = 0x201000 bytes\n"
373 msgstr ""
374 "$B< ulimit -s> # стек не ограничен ==E<gt> размер стека по умолчанию 2 МБ\n"
375 "unlimited\n"
376 "$B< ./a.out>\n"
377 "Атрибуты нити:\n"
378 " Состояние отсоединения = PTHREAD_CREATE_JOINABLE\n"
379 " Область = PTHREAD_SCOPE_SYSTEM\n"
380 " Унаследованный планировщик = PTHREAD_INHERIT_SCHED\n"
381 " Алгоритм планирования = SCHED_OTHER\n"
382 " Приоритет планирования = 0\n"
383 " Размер защиты = 4096 байт\n"
384 " Адрес стека = 0x40196000\n"
385 " Размер стека = 0x201000 байт\n"
386
387 #. type: Plain text
388 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
389 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
390 msgid ""
391 "When we supply a stack size as a command-line argument, the program "
392 "initializes a thread attributes object, sets various attributes in that "
393 "object, and passes a pointer to the object in the call to "
394 "B<pthread_create>(3). Running the program on Linux/x86-32 with the NPTL "
395 "threading implementation, we see the following:"
396 msgstr ""
397 "Если в командной строке мы укажем размер стека, то программа инициализирует "
398 "объект атрибутов нити, задаёт различные атрибуты в этом объекте и передаёт "
399 "указатель на объект в вызов B<pthread_create>(3). При запуске программы на "
400 "Linux/x86-32 с реализацией нитей NPTL мы увидим следующее:"
401
402 #. Results from glibc 2.8, SUSE 11.0; Oct 2008
403 #. type: Plain text
404 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
405 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
406 #, no-wrap
407 msgid ""
408 "$B< ./a.out 0x3000000>\n"
409 "posix_memalign() allocated at 0x40197000\n"
410 "Thread attributes:\n"
411 " Detach state = PTHREAD_CREATE_DETACHED\n"
412 " Scope = PTHREAD_SCOPE_SYSTEM\n"
413 " Inherit scheduler = PTHREAD_EXPLICIT_SCHED\n"
414 " Scheduling policy = SCHED_OTHER\n"
415 " Scheduling priority = 0\n"
416 " Guard size = 0 bytes\n"
417 " Stack address = 0x40197000\n"
418 " Stack size = 0x3000000 bytes\n"
419 msgstr ""
420 "$B< ./a.out 0x3000000>\n"
421 "posix_memalign() выделен по адресу 0x40197000\n"
422 "Атрибуты нити:\n"
423 " Состояние отсоединения = PTHREAD_CREATE_DETACHED\n"
424 " Область = PTHREAD_SCOPE_SYSTEM\n"
425 " Унаследованный планировщик = PTHREAD_EXPLICIT_SCHED\n"
426 " Алгоритм планирования = SCHED_OTHER\n"
427 " Приоритет планирования = 0\n"
428 " Размер защиты = 0 байт\n"
429 " Адрес стека = 0x40197000\n"
430 " Размер стека = 0x3000000 байт\n"
431
432 #. type: SS
433 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
434 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
435 #, no-wrap
436 msgid "Program source"
437 msgstr "Исходный код программы"
438
439 #. type: Plain text
440 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
441 #: opensuse-tumbleweed
442 #, no-wrap
443 msgid ""
444 "#define _GNU_SOURCE /* To get pthread_getattr_np() declaration */\n"
445 "#include E<lt>err.hE<gt>\n"
446 "#include E<lt>errno.hE<gt>\n"
447 "#include E<lt>pthread.hE<gt>\n"
448 "#include E<lt>stdio.hE<gt>\n"
449 "#include E<lt>stdlib.hE<gt>\n"
450 "#include E<lt>unistd.hE<gt>\n"
451 "\\&\n"
452 "static void\n"
453 "display_pthread_attr(pthread_attr_t *attr, char *prefix)\n"
454 "{\n"
455 " int s, i;\n"
456 " size_t v;\n"
457 " void *stkaddr;\n"
458 " struct sched_param sp;\n"
459 "\\&\n"
460 " s = pthread_attr_getdetachstate(attr, &i);\n"
461 " if (s != 0)\n"
462 " errc(EXIT_FAILURE, s, \"pthread_attr_getdetachstate\");\n"
463 " printf(\"%sDetach state = %s\\[rs]n\", prefix,\n"
464 " (i == PTHREAD_CREATE_DETACHED) ? \"PTHREAD_CREATE_DETACHED\" :\n"
465 " (i == PTHREAD_CREATE_JOINABLE) ? \"PTHREAD_CREATE_JOINABLE\" :\n"
466 " \"???\");\n"
467 "\\&\n"
468 " s = pthread_attr_getscope(attr, &i);\n"
469 " if (s != 0)\n"
470 " errc(EXIT_FAILURE, s, \"pthread_attr_getscope\");\n"
471 " printf(\"%sScope = %s\\[rs]n\", prefix,\n"
472 " (i == PTHREAD_SCOPE_SYSTEM) ? \"PTHREAD_SCOPE_SYSTEM\" :\n"
473 " (i == PTHREAD_SCOPE_PROCESS) ? \"PTHREAD_SCOPE_PROCESS\" :\n"
474 " \"???\");\n"
475 "\\&\n"
476 " s = pthread_attr_getinheritsched(attr, &i);\n"
477 " if (s != 0)\n"
478 " errc(EXIT_FAILURE, s, \"pthread_attr_getinheritsched\");\n"
479 " printf(\"%sInherit scheduler = %s\\[rs]n\", prefix,\n"
480 " (i == PTHREAD_INHERIT_SCHED) ? \"PTHREAD_INHERIT_SCHED\" :\n"
481 " (i == PTHREAD_EXPLICIT_SCHED) ? \"PTHREAD_EXPLICIT_SCHED\" :\n"
482 " \"???\");\n"
483 "\\&\n"
484 " s = pthread_attr_getschedpolicy(attr, &i);\n"
485 " if (s != 0)\n"
486 " errc(EXIT_FAILURE, s, \"pthread_attr_getschedpolicy\");\n"
487 " printf(\"%sScheduling policy = %s\\[rs]n\", prefix,\n"
488 " (i == SCHED_OTHER) ? \"SCHED_OTHER\" :\n"
489 " (i == SCHED_FIFO) ? \"SCHED_FIFO\" :\n"
490 " (i == SCHED_RR) ? \"SCHED_RR\" :\n"
491 " \"???\");\n"
492 "\\&\n"
493 " s = pthread_attr_getschedparam(attr, &sp);\n"
494 " if (s != 0)\n"
495 " errc(EXIT_FAILURE, s, \"pthread_attr_getschedparam\");\n"
496 " printf(\"%sScheduling priority = %d\\[rs]n\", prefix, sp.sched_priority);\n"
497 "\\&\n"
498 " s = pthread_attr_getguardsize(attr, &v);\n"
499 " if (s != 0)\n"
500 " errc(EXIT_FAILURE, s, \"pthread_attr_getguardsize\");\n"
501 " printf(\"%sGuard size = %zu bytes\\[rs]n\", prefix, v);\n"
502 "\\&\n"
503 " s = pthread_attr_getstack(attr, &stkaddr, &v);\n"
504 " if (s != 0)\n"
505 " errc(EXIT_FAILURE, s, \"pthread_attr_getstack\");\n"
506 " printf(\"%sStack address = %p\\[rs]n\", prefix, stkaddr);\n"
507 " printf(\"%sStack size = %#zx bytes\\[rs]n\", prefix, v);\n"
508 "}\n"
509 "\\&\n"
510 "static void *\n"
511 "thread_start(void *arg)\n"
512 "{\n"
513 " int s;\n"
514 " pthread_attr_t gattr;\n"
515 "\\&\n"
516 " /* pthread_getattr_np() is a non-standard GNU extension that\n"
517 " retrieves the attributes of the thread specified in its\n"
518 " first argument. */\n"
519 "\\&\n"
520 " s = pthread_getattr_np(pthread_self(), &gattr);\n"
521 " if (s != 0)\n"
522 " errc(EXIT_FAILURE, s, \"pthread_getattr_np\");\n"
523 "\\&\n"
524 " printf(\"Thread attributes:\\[rs]n\");\n"
525 " display_pthread_attr(&gattr, \"\\[rs]t\");\n"
526 "\\&\n"
527 " exit(EXIT_SUCCESS); /* Terminate all threads */\n"
528 "}\n"
529 "\\&\n"
530 "int\n"
531 "main(int argc, char *argv[])\n"
532 "{\n"
533 " pthread_t thr;\n"
534 " pthread_attr_t attr;\n"
535 " pthread_attr_t *attrp; /* NULL or &attr */\n"
536 " int s;\n"
537 "\\&\n"
538 " attrp = NULL;\n"
539 "\\&\n"
540 " /* If a command-line argument was supplied, use it to set the\n"
541 " stack-size attribute and set a few other thread attributes,\n"
542 " and set attrp pointing to thread attributes object. */\n"
543 "\\&\n"
544 " if (argc E<gt> 1) {\n"
545 " size_t stack_size;\n"
546 " void *sp;\n"
547 "\\&\n"
548 " attrp = &attr;\n"
549 "\\&\n"
550 " s = pthread_attr_init(&attr);\n"
551 " if (s != 0)\n"
552 " errc(EXIT_FAILURE, s, \"pthread_attr_init\");\n"
553 "\\&\n"
554 " s = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);\n"
555 " if (s != 0)\n"
556 " errc(EXIT_FAILURE, s, \"pthread_attr_setdetachstate\");\n"
557 "\\&\n"
558 " s = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);\n"
559 " if (s != 0)\n"
560 " errc(EXIT_FAILURE, s, \"pthread_attr_setinheritsched\");\n"
561 "\\&\n"
562 " stack_size = strtoul(argv[1], NULL, 0);\n"
563 "\\&\n"
564 " s = posix_memalign(&sp, sysconf(_SC_PAGESIZE), stack_size);\n"
565 " if (s != 0)\n"
566 " errc(EXIT_FAILURE, s, \"posix_memalign\");\n"
567 "\\&\n"
568 " printf(\"posix_memalign() allocated at %p\\[rs]n\", sp);\n"
569 "\\&\n"
570 " s = pthread_attr_setstack(&attr, sp, stack_size);\n"
571 " if (s != 0)\n"
572 " errc(EXIT_FAILURE, s, \"pthread_attr_setstack\");\n"
573 " }\n"
574 "\\&\n"
575 " s = pthread_create(&thr, attrp, &thread_start, NULL);\n"
576 " if (s != 0)\n"
577 " errc(EXIT_FAILURE, s, \"pthread_create\");\n"
578 "\\&\n"
579 " if (attrp != NULL) {\n"
580 " s = pthread_attr_destroy(attrp);\n"
581 " if (s != 0)\n"
582 " errc(EXIT_FAILURE, s, \"pthread_attr_destroy\");\n"
583 " }\n"
584 "\\&\n"
585 " pause(); /* Terminates when other thread calls exit() */\n"
586 "}\n"
587 msgstr ""
588
589 #. SRC END
590 #. type: SH
591 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
592 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
593 #, no-wrap
594 msgid "SEE ALSO"
595 msgstr "СМОТРИТЕ ТАКЖЕ"
596
597 #. type: Plain text
598 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
599 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
600 #, fuzzy
601 #| msgid ""
602 #| "B<pthread_attr_setaffinity_np>(3), B<pthread_attr_setdetachstate>(3), "
603 #| "B<pthread_attr_setguardsize>(3), B<pthread_attr_setinheritsched>(3), "
604 #| "B<pthread_attr_setschedparam>(3), B<pthread_attr_setschedpolicy>(3), "
605 #| "B<pthread_attr_setscope>(3), B<pthread_attr_setstack>(3), "
606 #| "B<pthread_attr_setstackaddr>(3), B<pthread_attr_setstacksize>(3), "
607 #| "B<pthread_create>(3), B<pthread_getattr_np>(3), "
608 #| "B<pthread_setattr_default_np>(3), B<pthreads>(7)"
609 msgid ""
610 "B<pthread_attr_setaffinity_np>(3), B<pthread_attr_setdetachstate>(3), "
611 "B<pthread_attr_setguardsize>(3), B<pthread_attr_setinheritsched>(3), "
612 "B<pthread_attr_setschedparam>(3), B<pthread_attr_setschedpolicy>(3), "
613 "B<pthread_attr_setscope>(3), B<pthread_attr_setsigmask_np>(3), "
614 "B<pthread_attr_setstack>(3), B<pthread_attr_setstackaddr>(3), "
615 "B<pthread_attr_setstacksize>(3), B<pthread_create>(3), "
616 "B<pthread_getattr_np>(3), B<pthread_setattr_default_np>(3), B<pthreads>(7)"
617 msgstr ""
618 "B<pthread_attr_setaffinity_np>(3), B<pthread_attr_setdetachstate>(3), "
619 "B<pthread_attr_setguardsize>(3), B<pthread_attr_setinheritsched>(3), "
620 "B<pthread_attr_setschedparam>(3), B<pthread_attr_setschedpolicy>(3), "
621 "B<pthread_attr_setscope>(3), B<pthread_attr_setstack>(3), "
622 "B<pthread_attr_setstackaddr>(3), B<pthread_attr_setstacksize>(3), "
623 "B<pthread_create>(3), B<pthread_getattr_np>(3), "
624 "B<pthread_setattr_default_np>(3), B<pthreads>(7)"
625
626 #. type: TH
627 #: debian-trixie
628 #, no-wrap
629 msgid "2024-06-15"
630 msgstr "15 июня 2024 г."
631
632 #. type: TH
633 #: debian-trixie
634 #, no-wrap
635 msgid "Linux man-pages 6.9.1"
636 msgstr "Страницы руководства Linux 6.9.1"
637
638 #. type: Plain text
639 #: debian-trixie
640 msgid "POSIX threads library (I<libpthread>, I<-lpthread>)"
641 msgstr "Библиотека потоков POSIX (I<libpthread>, I<-lpthread>)"
642
643 #. type: Plain text
644 #: debian-trixie fedora-44 fedora-rawhide
645 #, no-wrap
646 msgid ""
647 "#define _GNU_SOURCE /* To get pthread_getattr_np() declaration */\n"
648 "#include E<lt>err.hE<gt>\n"
649 "#include E<lt>errno.hE<gt>\n"
650 "#include E<lt>pthread.hE<gt>\n"
651 "#include E<lt>stdio.hE<gt>\n"
652 "#include E<lt>stdlib.hE<gt>\n"
653 "#include E<lt>unistd.hE<gt>\n"
654 "\\&\n"
655 "static void\n"
656 "display_pthread_attr(pthread_attr_t *attr, char *prefix)\n"
657 "{\n"
658 " int s, i;\n"
659 " size_t v;\n"
660 " void *stkaddr;\n"
661 " struct sched_param sp;\n"
662 "\\&\n"
663 " s = pthread_attr_getdetachstate(attr, &i);\n"
664 " if (s != 0)\n"
665 " errc(EXIT_FAILURE, s, \"pthread_attr_getdetachstate\");\n"
666 " printf(\"%sDetach state = %s\\[rs]n\", prefix,\n"
667 " (i == PTHREAD_CREATE_DETACHED) ? \"PTHREAD_CREATE_DETACHED\" :\n"
668 " (i == PTHREAD_CREATE_JOINABLE) ? \"PTHREAD_CREATE_JOINABLE\" :\n"
669 " \"???\");\n"
670 "\\&\n"
671 " s = pthread_attr_getscope(attr, &i);\n"
672 " if (s != 0)\n"
673 " errc(EXIT_FAILURE, s, \"pthread_attr_getscope\");\n"
674 " printf(\"%sScope = %s\\[rs]n\", prefix,\n"
675 " (i == PTHREAD_SCOPE_SYSTEM) ? \"PTHREAD_SCOPE_SYSTEM\" :\n"
676 " (i == PTHREAD_SCOPE_PROCESS) ? \"PTHREAD_SCOPE_PROCESS\" :\n"
677 " \"???\");\n"
678 "\\&\n"
679 " s = pthread_attr_getinheritsched(attr, &i);\n"
680 " if (s != 0)\n"
681 " errc(EXIT_FAILURE, s, \"pthread_attr_getinheritsched\");\n"
682 " printf(\"%sInherit scheduler = %s\\[rs]n\", prefix,\n"
683 " (i == PTHREAD_INHERIT_SCHED) ? \"PTHREAD_INHERIT_SCHED\" :\n"
684 " (i == PTHREAD_EXPLICIT_SCHED) ? \"PTHREAD_EXPLICIT_SCHED\" :\n"
685 " \"???\");\n"
686 "\\&\n"
687 " s = pthread_attr_getschedpolicy(attr, &i);\n"
688 " if (s != 0)\n"
689 " errc(EXIT_FAILURE, s, \"pthread_attr_getschedpolicy\");\n"
690 " printf(\"%sScheduling policy = %s\\[rs]n\", prefix,\n"
691 " (i == SCHED_OTHER) ? \"SCHED_OTHER\" :\n"
692 " (i == SCHED_FIFO) ? \"SCHED_FIFO\" :\n"
693 " (i == SCHED_RR) ? \"SCHED_RR\" :\n"
694 " \"???\");\n"
695 "\\&\n"
696 " s = pthread_attr_getschedparam(attr, &sp);\n"
697 " if (s != 0)\n"
698 " errc(EXIT_FAILURE, s, \"pthread_attr_getschedparam\");\n"
699 " printf(\"%sScheduling priority = %d\\[rs]n\", prefix, sp.sched_priority);\n"
700 "\\&\n"
701 " s = pthread_attr_getguardsize(attr, &v);\n"
702 " if (s != 0)\n"
703 " errc(EXIT_FAILURE, s, \"pthread_attr_getguardsize\");\n"
704 " printf(\"%sGuard size = %zu bytes\\[rs]n\", prefix, v);\n"
705 "\\&\n"
706 " s = pthread_attr_getstack(attr, &stkaddr, &v);\n"
707 " if (s != 0)\n"
708 " errc(EXIT_FAILURE, s, \"pthread_attr_getstack\");\n"
709 " printf(\"%sStack address = %p\\[rs]n\", prefix, stkaddr);\n"
710 " printf(\"%sStack size = %#zx bytes\\[rs]n\", prefix, v);\n"
711 "}\n"
712 "\\&\n"
713 "static void *\n"
714 "thread_start(void *arg)\n"
715 "{\n"
716 " int s;\n"
717 " pthread_attr_t gattr;\n"
718 "\\&\n"
719 " /* pthread_getattr_np() is a non-standard GNU extension that\n"
720 " retrieves the attributes of the thread specified in its\n"
721 " first argument. */\n"
722 "\\&\n"
723 " s = pthread_getattr_np(pthread_self(), &gattr);\n"
724 " if (s != 0)\n"
725 " errc(EXIT_FAILURE, s, \"pthread_getattr_np\");\n"
726 "\\&\n"
727 " printf(\"Thread attributes:\\[rs]n\");\n"
728 " display_pthread_attr(&gattr, \"\\[rs]t\");\n"
729 "\\&\n"
730 " exit(EXIT_SUCCESS); /* Terminate all threads */\n"
731 "}\n"
732 "\\&\n"
733 "int\n"
734 "main(int argc, char *argv[])\n"
735 "{\n"
736 " pthread_t thr;\n"
737 " pthread_attr_t attr;\n"
738 " pthread_attr_t *attrp; /* NULL or &attr */\n"
739 " int s;\n"
740 "\\&\n"
741 " attrp = NULL;\n"
742 "\\&\n"
743 " /* If a command-line argument was supplied, use it to set the\n"
744 " stack-size attribute and set a few other thread attributes,\n"
745 " and set attrp pointing to thread attributes object. */\n"
746 "\\&\n"
747 " if (argc E<gt> 1) {\n"
748 " size_t stack_size;\n"
749 " void *sp;\n"
750 "\\&\n"
751 " attrp = &attr;\n"
752 "\\&\n"
753 " s = pthread_attr_init(&attr);\n"
754 " if (s != 0)\n"
755 " errc(EXIT_FAILURE, s, \"pthread_attr_init\");\n"
756 "\\&\n"
757 " s = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);\n"
758 " if (s != 0)\n"
759 " errc(EXIT_FAILURE, s, \"pthread_attr_setdetachstate\");\n"
760 "\\&\n"
761 " s = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);\n"
762 " if (s != 0)\n"
763 " errc(EXIT_FAILURE, s, \"pthread_attr_setinheritsched\");\n"
764 "\\&\n"
765 " stack_size = strtoul(argv[1], NULL, 0);\n"
766 "\\&\n"
767 " s = posix_memalign(&sp, sysconf(_SC_PAGESIZE), stack_size);\n"
768 " if (s != 0)\n"
769 " errc(EXIT_FAILURE, s, \"posix_memalign\");\n"
770 "\\&\n"
771 " printf(\"posix_memalign() allocated at %p\\[rs]n\", sp);\n"
772 "\\&\n"
773 " s = pthread_attr_setstack(&attr, sp, stack_size);\n"
774 " if (s != 0)\n"
775 " errc(EXIT_FAILURE, s, \"pthread_attr_setstack\");\n"
776 " }\n"
777 "\\&\n"
778 " s = pthread_create(&thr, attrp, &thread_start, NULL);\n"
779 " if (s != 0)\n"
780 " errc(EXIT_FAILURE, s, \"pthread_create\");\n"
781 "\\&\n"
782 " if (attrp != NULL) {\n"
783 " s = pthread_attr_destroy(attrp);\n"
784 " if (s != 0)\n"
785 " errc(EXIT_FAILURE, s, \"pthread_attr_destroy\");\n"
786 " }\n"
787 "\\&\n"
788 " pause(); /* Terminates when other thread calls exit() */\n"
789 "}\n"
790 msgstr ""
791
792 #. type: TH
793 #: fedora-44 fedora-rawhide
794 #, no-wrap
795 msgid "2024-07-23"
796 msgstr "23 июля 2024 г."
797
798 #. type: TH
799 #: fedora-44 fedora-rawhide
800 #, no-wrap
801 msgid "Linux man-pages 6.13"
802 msgstr "Страницы руководства Linux 6.13"
803
804 #. type: TH
805 #: mageia-cauldron
806 #, no-wrap
807 msgid "Linux man-pages 6.17"
808 msgstr "Страницы руководства Linux 6.17"
809
810 #. type: TH
811 #: opensuse-leap-16-1 opensuse-tumbleweed
812 #, no-wrap
813 msgid "Linux man-pages (unreleased)"
814 msgstr "Страницы руководства Linux (не выпущены)"