Debian Codegraph @

po/ru/man3/pthread_cleanup_push.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 #, no-wrap
31 msgid "pthread_cleanup_push"
32 msgstr ""
33
34 #. type: TH
35 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
36 #: opensuse-tumbleweed
37 #, no-wrap
38 msgid "2025-08-20"
39 msgstr "20 августа 2025 г."
40
41 #. type: TH
42 #: archlinux debian-unstable
43 #, fuzzy, no-wrap
44 #| msgid "Linux man-pages 6.17"
45 msgid "Linux man-pages 6.18"
46 msgstr "Справочные страницы Linux 6.17"
47
48 #. type: SH
49 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
50 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
51 #, no-wrap
52 msgid "NAME"
53 msgstr "НАИМЕНОВАНИЕ"
54
55 #. type: Plain text
56 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
57 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
58 #, fuzzy
59 #| msgid ""
60 #| "pthread_cleanup_push, pthread_cleanup_pop - push and pop thread "
61 #| "cancellation clean-up handlers"
62 msgid ""
63 "pthread_cleanup_push, pthread_cleanup_pop - push and pop thread cancelation "
64 "clean-up handlers"
65 msgstr ""
66 "pthread_cleanup_push, pthread_cleanup_pop - помещает и выталкивает очищающие "
67 "обработчики при отмене нити"
68
69 #. type: SH
70 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
71 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
72 #, no-wrap
73 msgid "LIBRARY"
74 msgstr "БИБЛИОТЕКА"
75
76 #. type: Plain text
77 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
78 #: opensuse-leap-16-1 opensuse-tumbleweed
79 msgid "POSIX threads library (I<libpthread>,\\ I<-lpthread>)"
80 msgstr "Библиотека потоков POSIX (I<libpthread>,\\ I<-lpthread>)"
81
82 #. type: SH
83 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
84 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
85 #, no-wrap
86 msgid "SYNOPSIS"
87 msgstr "СИНТАКСИС"
88
89 #. type: Plain text
90 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
91 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
92 #, no-wrap
93 msgid "B<#include E<lt>pthread.hE<gt>>\n"
94 msgstr "B<#include E<lt>pthread.hE<gt>>\n"
95
96 #. type: Plain text
97 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
98 #: opensuse-leap-16-1 opensuse-tumbleweed
99 #, fuzzy, no-wrap
100 #| msgid ""
101 #| "B<void pthread_cleanup_push(void (*>I<routine>B<)(void *),>\n"
102 #| "B< void *>I<arg>B<);>\n"
103 #| "B<void pthread_cleanup_pop(int >I<execute>B<);>\n"
104 msgid ""
105 "B<void pthread_cleanup_push(typeof(void (void *)) *>I<routine>B<, void *>I<arg>B<);>\n"
106 "B<void pthread_cleanup_pop(int >I<execute>B<);>\n"
107 msgstr ""
108 "B<void pthread_cleanup_push(void (*>I<routine>B<)(void *),>\n"
109 "B< void *>I<arg>B<);>\n"
110 "B<void pthread_cleanup_pop(int >I<execute>B<);>\n"
111
112 #. type: SH
113 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
114 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
115 #, no-wrap
116 msgid "DESCRIPTION"
117 msgstr "ОПИСАНИЕ"
118
119 #. type: Plain text
120 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
121 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
122 #, fuzzy
123 #| msgid ""
124 #| "These functions manipulate the calling thread's stack of thread-"
125 #| "cancellation clean-up handlers. A clean-up handler is a function that is "
126 #| "automatically executed when a thread is canceled (or in various other "
127 #| "circumstances described below); it might, for example, unlock a mutex so "
128 #| "that it becomes available to other threads in the process."
129 msgid ""
130 "These functions manipulate the calling thread's stack of thread-cancelation "
131 "clean-up handlers. A clean-up handler is a function that is automatically "
132 "executed when a thread is canceled (or in various other circumstances "
133 "described below); it might, for example, unlock a mutex so that it becomes "
134 "available to other threads in the process."
135 msgstr ""
136 "Данные функции управляют стеком нити, вызывающим очищающие обработчики при "
137 "отмене нити. Очищающий обработчик — это функция, которая автоматически "
138 "вызывается при отмене нити (или в при других обстоятельствах, описанных "
139 "ниже); это может быть, например, отмена блокировки мьютекса, при которой он "
140 "становится доступным другим нитям процесса."
141
142 #. type: Plain text
143 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
144 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
145 msgid ""
146 "The B<pthread_cleanup_push>() function pushes I<routine> onto the top of "
147 "the stack of clean-up handlers. When I<routine> is later invoked, it will "
148 "be given I<arg> as its argument."
149 msgstr ""
150 "Функция B<pthread_cleanup_push>() помещает обработчик I<routine> наверх "
151 "стека очищающих обработчиков. Позднее, при вызове I<routine>, ему будет "
152 "передан I<arg> в качестве аргумента."
153
154 #. type: Plain text
155 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
156 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
157 msgid ""
158 "The B<pthread_cleanup_pop>() function removes the routine at the top of the "
159 "stack of clean-up handlers, and optionally executes it if I<execute> is "
160 "nonzero."
161 msgstr ""
162 "Функция B<pthread_cleanup_pop>() удаляет обработчик с вершины стека "
163 "очищающих обработчиков, и, возможно, выполняет его, если I<execute> не равно "
164 "нулю."
165
166 #. type: Plain text
167 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
168 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
169 #, fuzzy
170 #| msgid ""
171 #| "A cancellation clean-up handler is popped from the stack and executed in "
172 #| "the following circumstances:"
173 msgid ""
174 "A cancelation clean-up handler is popped from the stack and executed in the "
175 "following circumstances:"
176 msgstr ""
177 "Очищающий обработчик при отмене выталкивается из стека и выполняется при "
178 "следующих условиях:"
179
180 #. type: IP
181 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
182 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
183 #, no-wrap
184 msgid "\\[bu]"
185 msgstr "\\[bu]"
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 "When a thread is canceled, all of the stacked clean-up handlers are popped "
192 "and executed in the reverse of the order in which they were pushed onto the "
193 "stack."
194 msgstr ""
195 "Когда нить отменяется, все очищающие обработчики из стека выталкиваются и "
196 "вызываются в обратном порядке их помещения в стек."
197
198 #. type: Plain text
199 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
200 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
201 msgid ""
202 "When a thread terminates by calling B<pthread_exit>(3), all clean-up "
203 "handlers are executed as described in the preceding point. (Clean-up "
204 "handlers are I<not> called if the thread terminates by performing a "
205 "I<return> from the thread start function.)"
206 msgstr ""
207 "Когда нить завершается вызовом B<pthread_exit>(3), все очищающие обработчики "
208 "выполняются как описано в предыдущем пункте (очищающие обработчики I<не> "
209 "вызываются, если нить завершается I<возвратом> из начальной функции нити)."
210
211 #. type: Plain text
212 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
213 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
214 msgid ""
215 "When a thread calls B<pthread_cleanup_pop>() with a nonzero I<execute> "
216 "argument, the top-most clean-up handler is popped and executed."
217 msgstr ""
218 "Когда нить вызывает B<pthread_cleanup_pop>() с ненулевым значением аргумента "
219 "I<execute>, самый верхний очищающий обработчик выталкивается и выполняется."
220
221 #. type: Plain text
222 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
223 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
224 #, fuzzy
225 #| msgid ""
226 #| "POSIX.1 permits B<pthread_cleanup_push>() and B<pthread_cleanup_pop>() "
227 #| "to be implemented as macros that expand to text containing \\(aqB<{>\\(aq "
228 #| "and \\(aqB<}>\\(aq, respectively. For this reason, the caller must "
229 #| "ensure that calls to these functions are paired within the same function, "
230 #| "and at the same lexical nesting level. (In other words, a clean-up "
231 #| "handler is established only during the execution of a specified section "
232 #| "of code.)"
233 msgid ""
234 "POSIX.1 permits B<pthread_cleanup_push>() and B<pthread_cleanup_pop>() to "
235 "be implemented as macros that expand to text containing \\[aq]B<{>\\[aq] and "
236 "\\[aq]B<}>\\[aq], respectively. For this reason, the caller must ensure "
237 "that calls to these functions are paired within the same function, and at "
238 "the same lexical nesting level. (In other words, a clean-up handler is "
239 "established only during the execution of a specified section of code.)"
240 msgstr ""
241 "В POSIX.1 допускается реализация B<pthread_cleanup_push>() и "
242 "B<pthread_cleanup_pop>() в виде макросов, которые раскрывают текст, "
243 "содержащий \\(aqB<{>\\(aq и \\(aqB<}>\\(aq, соответственно. По этой причине, "
244 "вызывающий должен убедиться, что вызовы этих функций используются парно в "
245 "одной функции и на одном лексическом уровне вложенности (другими словами, "
246 "очищающий обработчик устанавливается только во время выполнения определённой "
247 "секции кода)."
248
249 #. type: Plain text
250 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
251 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
252 msgid ""
253 "Calling B<longjmp>(3) (B<siglongjmp>(3)) produces undefined results if any "
254 "call has been made to B<pthread_cleanup_push>() or "
255 "B<pthread_cleanup_pop>() without the matching call of the pair since the "
256 "jump buffer was filled by B<setjmp>(3) (B<sigsetjmp>(3)). Likewise, "
257 "calling B<longjmp>(3) (B<siglongjmp>(3)) from inside a clean-up handler "
258 "produces undefined results unless the jump buffer was also filled by "
259 "B<setjmp>(3) (B<sigsetjmp>(3)) inside the handler."
260 msgstr ""
261 "Вызов B<longjmp>(3) (B<siglongjmp>(3)) приводит к непредсказуемым "
262 "результатам, если был сделан любой вызов в B<pthread_cleanup_push>() или "
263 "B<pthread_cleanup_pop>() без соответствующего вызову пары, так как буфер "
264 "перехода (jump buffer) был заполнен B<setjmp>(3) (B<sigsetjmp>(3)). "
265 "Подобным образом, вызов B<longjmp>(3) (B<siglongjmp>(3)) изнутри очищающего "
266 "обработчика приводит к непредсказуемым результатам, если буфер перехода "
267 "также не был заполнен B<setjmp>(3) (B<sigsetjmp>(3)) внутри обработчика."
268
269 #. type: SH
270 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
271 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
272 #, no-wrap
273 msgid "RETURN VALUE"
274 msgstr "ВОЗВРАЩАЕМОЕ ЗНАЧЕНИЕ"
275
276 #. type: Plain text
277 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
278 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
279 msgid "These functions do not return a value."
280 msgstr "Данные функции не возвращают никаких значений."
281
282 #. type: SH
283 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
284 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
285 #, no-wrap
286 msgid "ERRORS"
287 msgstr "ОШИБКИ"
288
289 #. type: Plain text
290 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
291 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
292 msgid "There are no errors."
293 msgstr "Эти функции не вызывают ошибок."
294
295 #. type: SH
296 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
297 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
298 #, no-wrap
299 msgid "ATTRIBUTES"
300 msgstr "АТРИБУТЫ"
301
302 #. type: Plain text
303 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
304 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
305 msgid ""
306 "For an explanation of the terms used in this section, see B<attributes>(7)."
307 msgstr "Описание терминов данного раздела смотрите в B<attributes>(7)."
308
309 #. type: tbl table
310 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
311 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
312 #, no-wrap
313 msgid "Interface"
314 msgstr "Интерфейс"
315
316 #. type: tbl table
317 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
318 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
319 #, no-wrap
320 msgid "Attribute"
321 msgstr "Атрибут"
322
323 #. type: tbl table
324 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
325 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
326 #, no-wrap
327 msgid "Value"
328 msgstr "Значение"
329
330 #. type: tbl table
331 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
332 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
333 #, no-wrap
334 msgid ".na\n"
335 msgstr ".na\n"
336
337 #. type: tbl table
338 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
339 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
340 #, no-wrap
341 msgid ".nh\n"
342 msgstr ".nh\n"
343
344 #. type: tbl table
345 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
346 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
347 #, no-wrap
348 msgid ""
349 "B<pthread_cleanup_push>(),\n"
350 "B<pthread_cleanup_pop>()"
351 msgstr ""
352 "B<pthread_cleanup_push>(),\n"
353 "B<pthread_cleanup_pop>()"
354
355 #. type: tbl table
356 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
357 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
358 #, no-wrap
359 msgid "Thread safety"
360 msgstr "Безвредность в нитях"
361
362 #. type: tbl table
363 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
364 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
365 #, no-wrap
366 msgid "MT-Safe"
367 msgstr "MT-Safe"
368
369 #. type: SH
370 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
371 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
372 #, no-wrap
373 msgid "VERSIONS"
374 msgstr "ВЕРСИИ"
375
376 #. type: Plain text
377 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
378 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
379 #, fuzzy
380 #| msgid ""
381 #| "On Linux, the B<pthread_cleanup_push>() and B<pthread_cleanup_pop>() "
382 #| "functions I<are> implemented as macros that expand to text containing \\"
383 #| "(aqB<{>\\(aq and \\(aqB<}>\\(aq, respectively. This means that variables "
384 #| "declared within the scope of paired calls to these functions will be "
385 #| "visible within only that scope."
386 msgid ""
387 "On glibc, the B<pthread_cleanup_push>() and B<pthread_cleanup_pop>() "
388 "functions I<are> implemented as macros that expand to text containing \\"
389 "[aq]B<{>\\[aq] and \\[aq]B<}>\\[aq], respectively. This means that "
390 "variables declared within the scope of paired calls to these functions will "
391 "be visible within only that scope."
392 msgstr ""
393 "В Linux, функции B<pthread_cleanup_push>() и B<pthread_cleanup_pop>() "
394 "реализованы в виде макросов, которые расширяются до текста, содержащего \\"
395 "(aqB<{>\\(aq и \\(aqB<}>\\(aq, соответственно. Это означает, что переменные, "
396 "объявленные внутри области парных вызовов этих функций, будут видимы внутри "
397 "только этой области."
398
399 #. The text was actually added in the 2004 TC2
400 #. type: Plain text
401 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
402 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
403 msgid ""
404 "POSIX.1 says that the effect of using I<return>, I<break>, I<continue>, or "
405 "I<goto> to prematurely leave a block bracketed B<pthread_cleanup_push>() "
406 "and B<pthread_cleanup_pop>() is undefined. Portable applications should "
407 "avoid doing this."
408 msgstr ""
409 "В POSIX.1 сказано, что результат использования I<return>, I<break>, "
410 "I<continue> или I<goto> для преждевременного оставления блока, окружающего "
411 "B<pthread_cleanup_push>() и B<pthread_cleanup_pop>(), не определён. В "
412 "переносимых приложениях не нужно так делать."
413
414 #. type: SH
415 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
416 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
417 #, no-wrap
418 msgid "STANDARDS"
419 msgstr "СТАНДАРТЫ"
420
421 #. type: Plain text
422 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
423 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
424 msgid "POSIX.1-2008."
425 msgstr "POSIX.1-2008."
426
427 #. type: SH
428 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
429 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
430 #, no-wrap
431 msgid "HISTORY"
432 msgstr "ИСТОРИЯ"
433
434 #. type: Plain text
435 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
436 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
437 msgid "POSIX.1-2001. glibc 2.0."
438 msgstr "POSIX.1-2001. glibc 2.0."
439
440 #. type: SH
441 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
442 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
443 #, no-wrap
444 msgid "EXAMPLES"
445 msgstr "ПРИМЕРЫ"
446
447 #. type: Plain text
448 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
449 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
450 #, fuzzy
451 #| msgid ""
452 #| "The program below provides a simple example of the use of the functions "
453 #| "described in this page. The program creates a thread that executes a "
454 #| "loop bracketed by B<pthread_cleanup_push>() and "
455 #| "B<pthread_cleanup_pop>(). This loop increments a global variable, "
456 #| "I<cnt>, once each second. Depending on what command-line arguments are "
457 #| "supplied, the main thread sends the other thread a cancellation request, "
458 #| "or sets a global variable that causes the other thread to exit its loop "
459 #| "and terminate normally (by doing a I<return>)."
460 msgid ""
461 "The program below provides a simple example of the use of the functions "
462 "described in this page. The program creates a thread that executes a loop "
463 "bracketed by B<pthread_cleanup_push>() and B<pthread_cleanup_pop>(). This "
464 "loop increments a global variable, I<cnt>, once each second. Depending on "
465 "what command-line arguments are supplied, the main thread sends the other "
466 "thread a cancelation request, or sets a global variable that causes the "
467 "other thread to exit its loop and terminate normally (by doing a I<return>)."
468 msgstr ""
469 "Далее показан простой пример использования функций, описанных на этой "
470 "странице. Программа создаёт нить, которая выполняет цикл обрамлённый "
471 "B<pthread_cleanup_push>() и B<pthread_cleanup_pop>(). В этом цикле каждую "
472 "секунду увеличивается глобальная переменная I<cnt>. В зависимости от "
473 "аргументов командной строки главная нить посылает другой нити запрос на "
474 "отмену или изменяет глобальную переменную, что заставляет другую нить выйти "
475 "из цикла и завершить работу (с помощью I<return>)."
476
477 #. type: Plain text
478 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
479 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
480 #, fuzzy
481 #| msgid ""
482 #| "In the following shell session, the main thread sends a cancellation "
483 #| "request to the other thread:"
484 msgid ""
485 "In the following shell session, the main thread sends a cancelation request "
486 "to the other thread:"
487 msgstr "В этом сеансе главная нить посылает запрос отмены другой нити:"
488
489 #. type: Plain text
490 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
491 #: opensuse-tumbleweed
492 #, fuzzy, no-wrap
493 #| msgid ""
494 #| "$ B<./a.out>\n"
495 #| "New thread started\n"
496 #| "cnt = 0\n"
497 #| "cnt = 1\n"
498 #| "Canceling thread\n"
499 #| "Called clean-up handler\n"
500 #| "Thread was canceled; cnt = 0\n"
501 msgid ""
502 "$B< ./a.out>;\n"
503 "New thread started\n"
504 "cnt = 0\n"
505 "cnt = 1\n"
506 "Canceling thread\n"
507 "Called clean-up handler\n"
508 "Thread was canceled; cnt = 0\n"
509 msgstr ""
510 "$ B<./a.out>\n"
511 "Запущена новая нить\n"
512 "cnt = 0\n"
513 "cnt = 1\n"
514 "Отменяем нить\n"
515 "Вызван очищающий обработчик\n"
516 "Нить отменена; cnt = 0\n"
517
518 #. type: Plain text
519 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
520 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
521 #, fuzzy
522 #| msgid ""
523 #| "From the above, we see that the thread was canceled, and that the "
524 #| "cancellation clean-up handler was called and it reset the value of the "
525 #| "global variable I<cnt> to 0."
526 msgid ""
527 "From the above, we see that the thread was canceled, and that the "
528 "cancelation clean-up handler was called and it reset the value of the global "
529 "variable I<cnt> to 0."
530 msgstr ""
531 "Здесь мы видим, что нить была отменена и что был вызван очищающий обработчик "
532 "и он сбросил значение глобальной переменной I<cnt> в 0."
533
534 #. type: Plain text
535 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
536 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
537 msgid ""
538 "In the next run, the main program sets a global variable that causes other "
539 "thread to terminate normally:"
540 msgstr ""
541 "В следующем сеансе главная программа изменяет глобальную переменную, что "
542 "вызывает штатное завершение другой нити:"
543
544 #. type: Plain text
545 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
546 #: opensuse-tumbleweed
547 #, fuzzy, no-wrap
548 #| msgid ""
549 #| "$ B<./a.out x>\n"
550 #| "New thread started\n"
551 #| "cnt = 0\n"
552 #| "cnt = 1\n"
553 #| "Thread terminated normally; cnt = 2\n"
554 msgid ""
555 "$B< ./a.out x>;\n"
556 "New thread started\n"
557 "cnt = 0\n"
558 "cnt = 1\n"
559 "Thread terminated normally; cnt = 2\n"
560 msgstr ""
561 "$ B<./a.out x>\n"
562 "Запущена новая нить\n"
563 "cnt = 0\n"
564 "cnt = 1\n"
565 "Нить завершилась штатным образом; cnt = 2\n"
566
567 #. type: Plain text
568 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
569 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
570 msgid ""
571 "From the above, we see that the clean-up handler was not executed (because "
572 "I<cleanup_pop_arg> was 0), and therefore the value of I<cnt> was not reset."
573 msgstr ""
574 "Здесь мы видим, что очищающий обработчик не вызывался (так как "
575 "I<cleanup_pop_arg> равно 0), и поэтому значение I<cnt> не сброшено."
576
577 #. type: Plain text
578 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
579 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
580 msgid ""
581 "In the next run, the main program sets a global variable that causes the "
582 "other thread to terminate normally, and supplies a nonzero value for "
583 "I<cleanup_pop_arg>:"
584 msgstr ""
585 "В следующем сеансе главная программа изменяет глобальную переменную, что "
586 "вызывает штатное завершение другой нити, передаёт ненулевое значение в "
587 "I<cleanup_pop_arg>:"
588
589 #. type: Plain text
590 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
591 #: opensuse-tumbleweed
592 #, fuzzy, no-wrap
593 #| msgid ""
594 #| "$ B<./a.out x 1>\n"
595 #| "New thread started\n"
596 #| "cnt = 0\n"
597 #| "cnt = 1\n"
598 #| "Called clean-up handler\n"
599 #| "Thread terminated normally; cnt = 0\n"
600 msgid ""
601 "$B< ./a.out x 1>;\n"
602 "New thread started\n"
603 "cnt = 0\n"
604 "cnt = 1\n"
605 "Called clean-up handler\n"
606 "Thread terminated normally; cnt = 0\n"
607 msgstr ""
608 "$ B<./a.out x 1>\n"
609 "Запущена новая нить\n"
610 "cnt = 0\n"
611 "cnt = 1\n"
612 "Вызван очищающий обработчик\n"
613 "Нить завершилась штатным образом; cnt = 0\n"
614
615 #. type: Plain text
616 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
617 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
618 msgid ""
619 "In the above, we see that although the thread was not canceled, the clean-up "
620 "handler was executed, because the argument given to "
621 "B<pthread_cleanup_pop>() was nonzero."
622 msgstr ""
623 "Здесь мы видим, что хотя нить не отменена, всё же вызван очищающий "
624 "обработчик, так как в B<pthread_cleanup_pop>() передан ненулевой аргумент."
625
626 #. type: SS
627 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
628 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
629 #, no-wrap
630 msgid "Program source"
631 msgstr "Исходный код программы"
632
633 #. type: Plain text
634 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
635 #: opensuse-tumbleweed
636 #, no-wrap
637 msgid ""
638 "#include E<lt>err.hE<gt>\n"
639 "#include E<lt>errno.hE<gt>\n"
640 "#include E<lt>pthread.hE<gt>\n"
641 "#include E<lt>stdio.hE<gt>\n"
642 "#include E<lt>stdlib.hE<gt>\n"
643 "#include E<lt>sys/types.hE<gt>\n"
644 "#include E<lt>unistd.hE<gt>\n"
645 "\\&\n"
646 "static int done = 0;\n"
647 "static int cleanup_pop_arg = 0;\n"
648 "static int cnt = 0;\n"
649 "\\&\n"
650 "static void\n"
651 "cleanup_handler(void *arg)\n"
652 "{\n"
653 " printf(\"Called clean-up handler\\[rs]n\");\n"
654 " cnt = 0;\n"
655 "}\n"
656 "\\&\n"
657 "static void *\n"
658 "thread_start(void *arg)\n"
659 "{\n"
660 " time_t curr;\n"
661 "\\&\n"
662 " printf(\"New thread started\\[rs]n\");\n"
663 "\\&\n"
664 " pthread_cleanup_push(cleanup_handler, NULL);\n"
665 "\\&\n"
666 " curr = time(NULL);\n"
667 "\\&\n"
668 " while (!done) {\n"
669 " pthread_testcancel(); /* A cancelation point */\n"
670 " if (curr E<lt> time(NULL)) {\n"
671 " curr = time(NULL);\n"
672 " printf(\"cnt = %d\\[rs]n\", cnt); /* A cancelation point */\n"
673 " cnt++;\n"
674 " }\n"
675 " }\n"
676 "\\&\n"
677 " pthread_cleanup_pop(cleanup_pop_arg);\n"
678 " return NULL;\n"
679 "}\n"
680 "\\&\n"
681 "int\n"
682 "main(int argc, char *argv[])\n"
683 "{\n"
684 " pthread_t thr;\n"
685 " int s;\n"
686 " void *res;\n"
687 "\\&\n"
688 " s = pthread_create(&thr, NULL, thread_start, NULL);\n"
689 " if (s != 0)\n"
690 " errc(EXIT_FAILURE, s, \"pthread_create\");\n"
691 "\\&\n"
692 " sleep(2); /* Allow new thread to run a while */\n"
693 "\\&\n"
694 " if (argc E<gt> 1) {\n"
695 " if (argc E<gt> 2)\n"
696 " cleanup_pop_arg = atoi(argv[2]);\n"
697 " done = 1;\n"
698 "\\&\n"
699 " } else {\n"
700 " printf(\"Canceling thread\\[rs]n\");\n"
701 " s = pthread_cancel(thr);\n"
702 " if (s != 0)\n"
703 " errc(EXIT_FAILURE, s, \"pthread_cancel\");\n"
704 " }\n"
705 "\\&\n"
706 " s = pthread_join(thr, &res);\n"
707 " if (s != 0)\n"
708 " errc(EXIT_FAILURE, s, \"pthread_join\");\n"
709 "\\&\n"
710 " if (res == PTHREAD_CANCELED)\n"
711 " printf(\"Thread was canceled; cnt = %d\\[rs]n\", cnt);\n"
712 " else\n"
713 " printf(\"Thread terminated normally; cnt = %d\\[rs]n\", cnt);\n"
714 " exit(EXIT_SUCCESS);\n"
715 "}\n"
716 msgstr ""
717
718 #. SRC END
719 #. type: SH
720 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
721 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
722 #, no-wrap
723 msgid "SEE ALSO"
724 msgstr "СМОТРИТЕ ТАКЖЕ"
725
726 #. type: Plain text
727 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
728 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
729 msgid ""
730 "B<pthread_cancel>(3), B<pthread_cleanup_push_defer_np>(3), "
731 "B<pthread_setcancelstate>(3), B<pthread_testcancel>(3), B<pthreads>(7)"
732 msgstr ""
733 "B<pthread_cancel>(3), B<pthread_cleanup_push_defer_np>(3), "
734 "B<pthread_setcancelstate>(3), B<pthread_testcancel>(3), B<pthreads>(7)"
735
736 #. type: TH
737 #: debian-trixie
738 #, no-wrap
739 msgid "2024-06-15"
740 msgstr "15 июня 2024 г."
741
742 #. type: TH
743 #: debian-trixie
744 #, no-wrap
745 msgid "Linux man-pages 6.9.1"
746 msgstr "Страницы руководства Linux 6.9.1"
747
748 #. type: Plain text
749 #: debian-trixie
750 msgid "POSIX threads library (I<libpthread>, I<-lpthread>)"
751 msgstr "Библиотека потоков POSIX (I<libpthread>, I<-lpthread>)"
752
753 #. type: Plain text
754 #: debian-trixie
755 #, fuzzy, no-wrap
756 #| msgid ""
757 #| "B<void pthread_cleanup_push(void (*>I<routine>B<)(void *),>\n"
758 #| "B< void *>I<arg>B<);>\n"
759 #| "B<void pthread_cleanup_pop(int >I<execute>B<);>\n"
760 msgid ""
761 "B<void pthread_cleanup_push(void (*>I<routine>B<)(void *), void *>I<arg>B<);>\n"
762 "B<void pthread_cleanup_pop(int >I<execute>B<);>\n"
763 msgstr ""
764 "B<void pthread_cleanup_push(void (*>I<routine>B<)(void *),>\n"
765 "B< void *>I<arg>B<);>\n"
766 "B<void pthread_cleanup_pop(int >I<execute>B<);>\n"
767
768 #. type: Plain text
769 #: debian-trixie fedora-44 fedora-rawhide
770 #, no-wrap
771 msgid ""
772 "$ B<./a.out>\n"
773 "New thread started\n"
774 "cnt = 0\n"
775 "cnt = 1\n"
776 "Canceling thread\n"
777 "Called clean-up handler\n"
778 "Thread was canceled; cnt = 0\n"
779 msgstr ""
780 "$ B<./a.out>\n"
781 "Запущена новая нить\n"
782 "cnt = 0\n"
783 "cnt = 1\n"
784 "Отменяем нить\n"
785 "Вызван очищающий обработчик\n"
786 "Нить отменена; cnt = 0\n"
787
788 #. type: Plain text
789 #: debian-trixie fedora-44 fedora-rawhide
790 #, no-wrap
791 msgid ""
792 "$ B<./a.out x>\n"
793 "New thread started\n"
794 "cnt = 0\n"
795 "cnt = 1\n"
796 "Thread terminated normally; cnt = 2\n"
797 msgstr ""
798 "$ B<./a.out x>\n"
799 "Запущена новая нить\n"
800 "cnt = 0\n"
801 "cnt = 1\n"
802 "Нить завершилась штатным образом; cnt = 2\n"
803
804 #. type: Plain text
805 #: debian-trixie fedora-44 fedora-rawhide
806 #, no-wrap
807 msgid ""
808 "$ B<./a.out x 1>\n"
809 "New thread started\n"
810 "cnt = 0\n"
811 "cnt = 1\n"
812 "Called clean-up handler\n"
813 "Thread terminated normally; cnt = 0\n"
814 msgstr ""
815 "$ B<./a.out x 1>\n"
816 "Запущена новая нить\n"
817 "cnt = 0\n"
818 "cnt = 1\n"
819 "Вызван очищающий обработчик\n"
820 "Нить завершилась штатным образом; cnt = 0\n"
821
822 #. type: Plain text
823 #: debian-trixie fedora-44 fedora-rawhide
824 #, no-wrap
825 msgid ""
826 "#include E<lt>errno.hE<gt>\n"
827 "#include E<lt>pthread.hE<gt>\n"
828 "#include E<lt>stdio.hE<gt>\n"
829 "#include E<lt>stdlib.hE<gt>\n"
830 "#include E<lt>sys/types.hE<gt>\n"
831 "#include E<lt>unistd.hE<gt>\n"
832 "\\&\n"
833 "#define handle_error_en(en, msg) \\[rs]\n"
834 " do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)\n"
835 "\\&\n"
836 "static int done = 0;\n"
837 "static int cleanup_pop_arg = 0;\n"
838 "static int cnt = 0;\n"
839 "\\&\n"
840 "static void\n"
841 "cleanup_handler(void *arg)\n"
842 "{\n"
843 " printf(\"Called clean-up handler\\[rs]n\");\n"
844 " cnt = 0;\n"
845 "}\n"
846 "\\&\n"
847 "static void *\n"
848 "thread_start(void *arg)\n"
849 "{\n"
850 " time_t curr;\n"
851 "\\&\n"
852 " printf(\"New thread started\\[rs]n\");\n"
853 "\\&\n"
854 " pthread_cleanup_push(cleanup_handler, NULL);\n"
855 "\\&\n"
856 " curr = time(NULL);\n"
857 "\\&\n"
858 " while (!done) {\n"
859 " pthread_testcancel(); /* A cancelation point */\n"
860 " if (curr E<lt> time(NULL)) {\n"
861 " curr = time(NULL);\n"
862 " printf(\"cnt = %d\\[rs]n\", cnt); /* A cancelation point */\n"
863 " cnt++;\n"
864 " }\n"
865 " }\n"
866 "\\&\n"
867 " pthread_cleanup_pop(cleanup_pop_arg);\n"
868 " return NULL;\n"
869 "}\n"
870 "\\&\n"
871 "int\n"
872 "main(int argc, char *argv[])\n"
873 "{\n"
874 " pthread_t thr;\n"
875 " int s;\n"
876 " void *res;\n"
877 "\\&\n"
878 " s = pthread_create(&thr, NULL, thread_start, NULL);\n"
879 " if (s != 0)\n"
880 " handle_error_en(s, \"pthread_create\");\n"
881 "\\&\n"
882 " sleep(2); /* Allow new thread to run a while */\n"
883 "\\&\n"
884 " if (argc E<gt> 1) {\n"
885 " if (argc E<gt> 2)\n"
886 " cleanup_pop_arg = atoi(argv[2]);\n"
887 " done = 1;\n"
888 "\\&\n"
889 " } else {\n"
890 " printf(\"Canceling thread\\[rs]n\");\n"
891 " s = pthread_cancel(thr);\n"
892 " if (s != 0)\n"
893 " handle_error_en(s, \"pthread_cancel\");\n"
894 " }\n"
895 "\\&\n"
896 " s = pthread_join(thr, &res);\n"
897 " if (s != 0)\n"
898 " handle_error_en(s, \"pthread_join\");\n"
899 "\\&\n"
900 " if (res == PTHREAD_CANCELED)\n"
901 " printf(\"Thread was canceled; cnt = %d\\[rs]n\", cnt);\n"
902 " else\n"
903 " printf(\"Thread terminated normally; cnt = %d\\[rs]n\", cnt);\n"
904 " exit(EXIT_SUCCESS);\n"
905 "}\n"
906 msgstr ""
907
908 #. type: TH
909 #: fedora-44 fedora-rawhide
910 #, no-wrap
911 msgid "2024-12-13"
912 msgstr "13 декабря 2024 г."
913
914 #. type: TH
915 #: fedora-44 fedora-rawhide
916 #, no-wrap
917 msgid "Linux man-pages 6.13"
918 msgstr "Страницы руководства Linux 6.13"
919
920 #. type: TH
921 #: mageia-cauldron
922 #, no-wrap
923 msgid "Linux man-pages 6.17"
924 msgstr "Страницы руководства Linux 6.17"
925
926 #. type: TH
927 #: opensuse-leap-16-1 opensuse-tumbleweed
928 #, no-wrap
929 msgid "Linux man-pages (unreleased)"
930 msgstr "Страницы руководства Linux (не выпущены)"