Debian Codegraph @

templates/man3/pthread_cond_init.3.pot

raw
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: 2026-06-05 06:38+0200\n"
11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <[email protected]>\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 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
21 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
22 #, no-wrap
23 msgid "pthread_cond_init"
24 msgstr ""
25
26 #. type: TH
27 #: archlinux debian-unstable opensuse-leap-16-1 opensuse-tumbleweed
28 #, no-wrap
29 msgid "2026-03-22"
30 msgstr ""
31
32 #. type: TH
33 #: archlinux debian-unstable
34 #, no-wrap
35 msgid "Linux man-pages 6.18"
36 msgstr ""
37
38 #. type: SH
39 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
40 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
41 #, no-wrap
42 msgid "NAME"
43 msgstr ""
44
45 #. type: Plain text
46 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
47 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
48 msgid ""
49 "pthread_cond_init, pthread_cond_signal, pthread_cond_broadcast, "
50 "pthread_cond_wait, pthread_cond_timedwait, pthread_cond_destroy - operations "
51 "on conditions"
52 msgstr ""
53
54 #. type: SH
55 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
56 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
57 #, no-wrap
58 msgid "SYNOPSIS"
59 msgstr ""
60
61 #. type: Plain text
62 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
63 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
64 #, no-wrap
65 msgid "B<#include E<lt>pthread.hE<gt>>\n"
66 msgstr ""
67
68 #. type: Plain text
69 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
70 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
71 #, no-wrap
72 msgid "B<pthread_cond_t >I<cond>B< = PTHREAD_COND_INITIALIZER;>\n"
73 msgstr ""
74
75 #. type: Plain text
76 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
77 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
78 #, no-wrap
79 msgid ""
80 "B<int pthread_cond_init(pthread_cond_t *>I<cond>B<,>\n"
81 "B< pthread_condattr_t *>I<cond_attr>B<);>\n"
82 "B<int pthread_cond_signal(pthread_cond_t *>I<cond>B<);>\n"
83 "B<int pthread_cond_broadcast(pthread_cond_t *>I<cond>B<);>\n"
84 "B<int pthread_cond_wait(pthread_cond_t *>I<cond>B<, pthread_mutex_t *>I<mutex>B<);>\n"
85 "B<int pthread_cond_timedwait(pthread_cond_t *>I<cond>B<, pthread_mutex_t *>I<mutex>B<,>\n"
86 "B< const struct timespec *>I<abstime>B<);>\n"
87 "B<int pthread_cond_destroy(pthread_cond_t *>I<cond>B<);>\n"
88 msgstr ""
89
90 #. type: SH
91 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
92 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
93 #, no-wrap
94 msgid "DESCRIPTION"
95 msgstr ""
96
97 #. type: Plain text
98 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
99 #: opensuse-tumbleweed
100 msgid ""
101 "A condition (short for \"condition variable\") is a synchronization device "
102 "that allows threads to suspend execution and relinquish the processors until "
103 "some predicate on shared data is satisfied. The basic operations on "
104 "conditions are: signal the condition (when the predicate becomes true), and "
105 "wait for the condition, suspending the thread execution until another thread "
106 "signals the condition."
107 msgstr ""
108
109 #. type: Plain text
110 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
111 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
112 msgid ""
113 "A condition variable must always be associated with a mutex, to avoid the "
114 "race condition where a thread prepares to wait on a condition variable and "
115 "another thread signals the condition just before the first thread actually "
116 "waits on it."
117 msgstr ""
118
119 #. type: Plain text
120 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
121 #: opensuse-tumbleweed
122 msgid ""
123 "B<pthread_cond_init>() initializes the condition variable I<cond>, using "
124 "the condition attributes specified in I<cond_attr>, or default attributes if "
125 "I<cond_attr> is NULL. The LinuxThreads implementation supports no "
126 "attributes for conditions, hence the I<cond_attr> parameter is actually "
127 "ignored."
128 msgstr ""
129
130 #. type: Plain text
131 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
132 #: opensuse-tumbleweed
133 msgid ""
134 "Variables of type I<pthread_cond_t> can also be initialized statically, "
135 "using the constant B<PTHREAD_COND_INITIALIZER>."
136 msgstr ""
137
138 #. type: Plain text
139 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
140 #: opensuse-tumbleweed
141 msgid ""
142 "B<pthread_cond_signal>() restarts one of the threads that are waiting on "
143 "the condition variable I<cond>. If no threads are waiting on I<cond>, "
144 "nothing happens. If several threads are waiting on I<cond>, exactly one is "
145 "restarted, but it is not specified which."
146 msgstr ""
147
148 #. type: Plain text
149 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
150 #: opensuse-tumbleweed
151 msgid ""
152 "B<pthread_cond_broadcast>() restarts all the threads that are waiting on "
153 "the condition variable I<cond>. Nothing happens if no threads are waiting "
154 "on I<cond>."
155 msgstr ""
156
157 #. type: Plain text
158 #: archlinux debian-unstable opensuse-leap-16-1 opensuse-tumbleweed
159 msgid ""
160 "B<pthread_cond_wait>() atomically unlocks the I<mutex> (as per "
161 "B<pthread_mutex_unlock>()) and waits for the condition variable I<cond> to "
162 "be signaled. The thread execution is suspended and does not consume any CPU "
163 "time until the condition variable is signaled. The I<mutex> must be locked "
164 "by the calling thread on entrance to B<pthread_cond_wait>(). Before "
165 "returning to the calling thread, B<pthread_cond_wait>() re-acquires "
166 "I<mutex> (as per B<pthread_mutex_lock>())."
167 msgstr ""
168
169 #. type: Plain text
170 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
171 #: opensuse-tumbleweed
172 msgid ""
173 "Unlocking the mutex and suspending on the condition variable is done "
174 "atomically. Thus, if all threads always acquire the mutex before signaling "
175 "the condition, this guarantees that the condition cannot be signaled (and "
176 "thus ignored) between the time a thread locks the mutex and the time it "
177 "waits on the condition variable. See CAVEATS below."
178 msgstr ""
179
180 #. type: Plain text
181 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
182 #: opensuse-tumbleweed
183 msgid ""
184 "B<pthread_cond_timedwait>() atomically unlocks I<mutex> and waits on "
185 "I<cond>, as B<pthread_cond_wait>() does, but it also bounds the duration of "
186 "the wait. If I<cond> has not been signaled within the amount of time "
187 "specified by I<abstime>, the mutex I<mutex> is re-acquired and "
188 "B<pthread_cond_timedwait>() returns the error B<ETIMEDOUT>. The I<abstime> "
189 "parameter specifies an absolute time, with the same origin as B<time>(2) "
190 "and B<gettimeofday>(2): an I<abstime> of 0 corresponds to 00:00:00 GMT, "
191 "January 1, 1970."
192 msgstr ""
193
194 #. type: Plain text
195 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
196 #: opensuse-tumbleweed
197 msgid ""
198 "B<pthread_cond_destroy>() destroys a condition variable, freeing the "
199 "resources it might hold. No threads must be waiting on the condition "
200 "variable on entrance to B<pthread_cond_destroy>(). In the LinuxThreads "
201 "implementation, no resources are associated with condition variables, thus "
202 "B<pthread_cond_destroy>() actually does nothing except checking that the "
203 "condition has no waiting threads."
204 msgstr ""
205
206 #. type: SH
207 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
208 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
209 #, no-wrap
210 msgid "CANCELLATION"
211 msgstr ""
212
213 #. type: Plain text
214 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
215 #: opensuse-tumbleweed
216 msgid ""
217 "B<pthread_cond_wait>() and B<pthread_cond_timedwait>() are cancelation "
218 "points. If a thread is cancelled while suspended in one of these functions, "
219 "the thread immediately resumes execution, then locks again the I<mutex> "
220 "argument to B<pthread_cond_wait>() and B<pthread_cond_timedwait>(), and "
221 "finally executes the cancelation. Consequently, cleanup handlers are "
222 "assured that I<mutex> is locked when they are called."
223 msgstr ""
224
225 #. type: SH
226 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
227 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
228 #, no-wrap
229 msgid "ASYNC-SIGNAL SAFETY"
230 msgstr ""
231
232 #. type: Plain text
233 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
234 #: opensuse-tumbleweed
235 msgid ""
236 "The condition functions are not async-signal safe, and should not be called "
237 "from a signal handler. In particular, calling B<pthread_cond_signal>() or "
238 "B<pthread_cond_broadcast>() from a signal handler may deadlock the calling "
239 "thread."
240 msgstr ""
241
242 #. type: SH
243 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
244 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
245 #, no-wrap
246 msgid "RETURN VALUE"
247 msgstr ""
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 "All condition variable functions return 0 on success and a non-zero error "
254 "code on error."
255 msgstr ""
256
257 #. type: SH
258 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
259 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
260 #, no-wrap
261 msgid "ERRORS"
262 msgstr ""
263
264 #. type: Plain text
265 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
266 #: opensuse-tumbleweed
267 msgid ""
268 "B<pthread_cond_init>(), B<pthread_cond_signal>(), "
269 "B<pthread_cond_broadcast>(), and B<pthread_cond_wait>() never return an "
270 "error code."
271 msgstr ""
272
273 #. type: Plain text
274 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
275 #: opensuse-tumbleweed
276 msgid ""
277 "The B<pthread_cond_timedwait>() function returns the following error codes "
278 "on error:"
279 msgstr ""
280
281 #. type: TP
282 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
283 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
284 #, no-wrap
285 msgid "B<ETIMEDOUT>"
286 msgstr ""
287
288 #. type: Plain text
289 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
290 #: opensuse-tumbleweed
291 msgid ""
292 "The condition variable was not signaled until the timeout specified by "
293 "I<abstime .>"
294 msgstr ""
295
296 #. type: Plain text
297 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
298 #: opensuse-tumbleweed
299 msgid ""
300 "The B<pthread_cond_destroy>() function returns the following error code on "
301 "error:"
302 msgstr ""
303
304 #. type: TP
305 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
306 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
307 #, no-wrap
308 msgid "B<EBUSY>"
309 msgstr ""
310
311 #. type: Plain text
312 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
313 #: opensuse-tumbleweed
314 msgid "Some threads are currently waiting on I<cond .>"
315 msgstr ""
316
317 #. type: SH
318 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
319 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
320 #, no-wrap
321 msgid "SEE ALSO"
322 msgstr ""
323
324 #. type: Plain text
325 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
326 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
327 msgid ""
328 "B<pthread_condattr_init>(3), B<pthread_mutex_lock>(3), "
329 "B<pthread_mutex_unlock>(3), B<gettimeofday>(2), B<nanosleep>(2)."
330 msgstr ""
331
332 #. type: SH
333 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
334 #: opensuse-tumbleweed
335 #, no-wrap
336 msgid "CAVEATS"
337 msgstr ""
338
339 #. type: Plain text
340 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
341 #: opensuse-tumbleweed
342 msgid ""
343 "The implementation of the provided functions until glibc 2.25 used an "
344 "internal data lock. This lock did not support priority-inheritance and was "
345 "subject to unbounded priority inversion, visible on a real-time system."
346 msgstr ""
347
348 #. type: Plain text
349 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
350 #: opensuse-tumbleweed
351 msgid ""
352 "After the rewrite of the implementation in glibc 2.25 the usage of internal "
353 "lock changed. The internal lock is always acquired by the signaling "
354 "functions B<pthread_cond_signal>() and B<pthread_cond_broadcast>(). The "
355 "waiting function acquires the lock if the waiting process was interrupted. "
356 "The interruption can be caused for instance by a specified timeout, and "
357 "denoted by the error value B<ETIMEDOUTA>, or by a received signal, which is "
358 "denoted by the error value B<EINTR>."
359 msgstr ""
360
361 #. type: SH
362 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
363 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
364 #, no-wrap
365 msgid "EXAMPLE"
366 msgstr ""
367
368 #. type: Plain text
369 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
370 #: opensuse-tumbleweed
371 msgid ""
372 "Consider two shared variables I<x> and I<y ,> protected by the mutex I<mut>, "
373 "and a condition variable I<cond> that is to be signaled whenever I<x> "
374 "becomes greater than I<y>."
375 msgstr ""
376
377 #. type: Plain text
378 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
379 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
380 #, no-wrap
381 msgid ""
382 "B<int x,y;\n"
383 "pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;\n"
384 "pthread_cond_t cond = PTHREAD_COND_INITIALIZER;>\n"
385 msgstr ""
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 "Waiting until I<x> is greater than I<y> is performed as follows:"
391 msgstr ""
392
393 #. type: Plain text
394 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
395 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
396 #, no-wrap
397 msgid ""
398 "B<pthread_mutex_lock(&mut);\n"
399 "while (x E<lt>= y) {\n"
400 " pthread_cond_wait(&cond, &mut);\n"
401 "}\n"
402 "/* operate on x and y */\n"
403 "pthread_mutex_unlock(&mut);>\n"
404 msgstr ""
405
406 #. type: Plain text
407 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
408 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
409 msgid ""
410 "Modifications on I<x> and I<y> that may cause I<x> to become greater than "
411 "I<y> should signal the condition if needed:"
412 msgstr ""
413
414 #. type: Plain text
415 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
416 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
417 #, no-wrap
418 msgid ""
419 "B<pthread_mutex_lock(&mut);\n"
420 "/* modify x and y */\n"
421 "if (x E<gt> y) pthread_cond_broadcast(&cond);\n"
422 "pthread_mutex_unlock(&mut);>\n"
423 msgstr ""
424
425 #. type: Plain text
426 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
427 #: opensuse-tumbleweed
428 msgid ""
429 "If it can be proved that at most one waiting thread needs to be waken up "
430 "(for instance, if there are only two threads communicating through I<x> and "
431 "I<y>), B<pthread_cond_signal>() can be used as a slightly more efficient "
432 "alternative to B<pthread_cond_broadcast>(). In doubt, use "
433 "B<pthread_cond_broadcast>()."
434 msgstr ""
435
436 #. type: Plain text
437 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
438 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
439 msgid ""
440 "To wait for I<x> to become greater than I<y> with a timeout of 5 seconds, do:"
441 msgstr ""
442
443 #. type: Plain text
444 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
445 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
446 #, no-wrap
447 msgid ""
448 "B<struct timeval now;\n"
449 "struct timespec timeout;\n"
450 "int retcode;\n"
451 "\\&\n"
452 "pthread_mutex_lock(&mut);\n"
453 "gettimeofday(&now);\n"
454 "timeout.tv_sec = now.tv_sec + 5;\n"
455 "timeout.tv_nsec = now.tv_usec * 1000;\n"
456 "retcode = 0;\n"
457 "while (x E<lt>= y && retcode != ETIMEDOUT) {\n"
458 " retcode = pthread_cond_timedwait(&cond, &mut, &timeout);\n"
459 "}\n"
460 "if (retcode == ETIMEDOUT) {\n"
461 " /* timeout occurred */\n"
462 "} else {\n"
463 " /* operate on x and y */\n"
464 "}\n"
465 "pthread_mutex_unlock(&mut);>\n"
466 msgstr ""
467
468 #. type: TH
469 #: debian-trixie
470 #, no-wrap
471 msgid "2024-06-16"
472 msgstr ""
473
474 #. type: TH
475 #: debian-trixie
476 #, no-wrap
477 msgid "Linux man-pages 6.9.1"
478 msgstr ""
479
480 #. type: Plain text
481 #: debian-trixie fedora-44 fedora-rawhide
482 msgid ""
483 "A condition (short for ``condition variable'') is a synchronization device "
484 "that allows threads to suspend execution and relinquish the processors until "
485 "some predicate on shared data is satisfied. The basic operations on "
486 "conditions are: signal the condition (when the predicate becomes true), and "
487 "wait for the condition, suspending the thread execution until another thread "
488 "signals the condition."
489 msgstr ""
490
491 #. type: Plain text
492 #: debian-trixie fedora-44 fedora-rawhide
493 msgid ""
494 "B<pthread_cond_init> initializes the condition variable I<cond>, using the "
495 "condition attributes specified in I<cond_attr>, or default attributes if "
496 "I<cond_attr> is B<NULL>. The LinuxThreads implementation supports no "
497 "attributes for conditions, hence the I<cond_attr> parameter is actually "
498 "ignored."
499 msgstr ""
500
501 #. type: Plain text
502 #: debian-trixie fedora-44 fedora-rawhide
503 msgid ""
504 "Variables of type B<pthread_cond_t> can also be initialized statically, "
505 "using the constant B<PTHREAD_COND_INITIALIZER>."
506 msgstr ""
507
508 #. type: Plain text
509 #: debian-trixie fedora-44 fedora-rawhide
510 msgid ""
511 "B<pthread_cond_signal> restarts one of the threads that are waiting on the "
512 "condition variable I<cond>. If no threads are waiting on I<cond>, nothing "
513 "happens. If several threads are waiting on I<cond>, exactly one is "
514 "restarted, but it is not specified which."
515 msgstr ""
516
517 #. type: Plain text
518 #: debian-trixie fedora-44 fedora-rawhide
519 msgid ""
520 "B<pthread_cond_broadcast> restarts all the threads that are waiting on the "
521 "condition variable I<cond>. Nothing happens if no threads are waiting on "
522 "I<cond>."
523 msgstr ""
524
525 #. type: Plain text
526 #: debian-trixie
527 msgid ""
528 "B<pthread_cond_wait> atomically unlocks the I<mutex> (as per "
529 "B<pthread_unlock_mutex>) and waits for the condition variable I<cond> to be "
530 "signaled. The thread execution is suspended and does not consume any CPU "
531 "time until the condition variable is signaled. The I<mutex> must be locked "
532 "by the calling thread on entrance to B<pthread_cond_wait>. Before returning "
533 "to the calling thread, B<pthread_cond_wait> re-acquires I<mutex> (as per "
534 "B<pthread_lock_mutex>)."
535 msgstr ""
536
537 #. type: Plain text
538 #: debian-trixie fedora-44 fedora-rawhide
539 msgid ""
540 "Unlocking the mutex and suspending on the condition variable is done "
541 "atomically. Thus, if all threads always acquire the mutex before signaling "
542 "the condition, this guarantees that the condition cannot be signaled (and "
543 "thus ignored) between the time a thread locks the mutex and the time it "
544 "waits on the condition variable."
545 msgstr ""
546
547 #. type: Plain text
548 #: debian-trixie fedora-44 fedora-rawhide
549 msgid ""
550 "B<pthread_cond_timedwait> atomically unlocks I<mutex> and waits on I<cond>, "
551 "as B<pthread_cond_wait> does, but it also bounds the duration of the wait. "
552 "If I<cond> has not been signaled within the amount of time specified by "
553 "I<abstime>, the mutex I<mutex> is re-acquired and B<pthread_cond_timedwait> "
554 "returns the error B<ETIMEDOUT>. The I<abstime> parameter specifies an "
555 "absolute time, with the same origin as B<time>(2) and B<gettimeofday>(2): an "
556 "I<abstime> of 0 corresponds to 00:00:00 GMT, January 1, 1970."
557 msgstr ""
558
559 #. type: Plain text
560 #: debian-trixie fedora-44 fedora-rawhide
561 msgid ""
562 "B<pthread_cond_destroy> destroys a condition variable, freeing the resources "
563 "it might hold. No threads must be waiting on the condition variable on "
564 "entrance to B<pthread_cond_destroy>. In the LinuxThreads implementation, no "
565 "resources are associated with condition variables, thus "
566 "B<pthread_cond_destroy> actually does nothing except checking that the "
567 "condition has no waiting threads."
568 msgstr ""
569
570 #. type: Plain text
571 #: debian-trixie fedora-44 fedora-rawhide
572 msgid ""
573 "B<pthread_cond_wait> and B<pthread_cond_timedwait> are cancelation points. "
574 "If a thread is cancelled while suspended in one of these functions, the "
575 "thread immediately resumes execution, then locks again the I<mutex> argument "
576 "to B<pthread_cond_wait> and B<pthread_cond_timedwait>, and finally executes "
577 "the cancelation. Consequently, cleanup handlers are assured that I<mutex> "
578 "is locked when they are called."
579 msgstr ""
580
581 #. type: Plain text
582 #: debian-trixie fedora-44 fedora-rawhide
583 msgid ""
584 "The condition functions are not async-signal safe, and should not be called "
585 "from a signal handler. In particular, calling B<pthread_cond_signal> or "
586 "B<pthread_cond_broadcast> from a signal handler may deadlock the calling "
587 "thread."
588 msgstr ""
589
590 #. type: Plain text
591 #: debian-trixie fedora-44 fedora-rawhide
592 msgid ""
593 "B<pthread_cond_init>, B<pthread_cond_signal>, B<pthread_cond_broadcast>, and "
594 "B<pthread_cond_wait> never return an error code."
595 msgstr ""
596
597 #. type: Plain text
598 #: debian-trixie fedora-44 fedora-rawhide
599 msgid ""
600 "The B<pthread_cond_timedwait> function returns the following error codes on "
601 "error:"
602 msgstr ""
603
604 #. type: Plain text
605 #: debian-trixie fedora-44 fedora-rawhide
606 msgid ""
607 "The condition variable was not signaled until the timeout specified by "
608 "I<abstime>."
609 msgstr ""
610
611 #. type: TP
612 #: debian-trixie
613 #, no-wrap
614 msgid "B<EINTR>"
615 msgstr ""
616
617 #. type: Plain text
618 #: debian-trixie
619 msgid "B<pthread_cond_timedwait> was interrupted by a signal."
620 msgstr ""
621
622 #. type: Plain text
623 #: debian-trixie fedora-44 fedora-rawhide
624 msgid ""
625 "The B<pthread_cond_destroy> function returns the following error code on "
626 "error:"
627 msgstr ""
628
629 #. type: Plain text
630 #: debian-trixie fedora-44 fedora-rawhide
631 msgid "Some threads are currently waiting on I<cond>."
632 msgstr ""
633
634 #. type: Plain text
635 #: debian-trixie fedora-44 fedora-rawhide
636 msgid ""
637 "Consider two shared variables I<x> and I<y>, protected by the mutex I<mut>, "
638 "and a condition variable I<cond> that is to be signaled whenever I<x> "
639 "becomes greater than I<y>."
640 msgstr ""
641
642 #. type: Plain text
643 #: debian-trixie fedora-44 fedora-rawhide
644 msgid ""
645 "If it can be proved that at most one waiting thread needs to be waken up "
646 "(for instance, if there are only two threads communicating through I<x> and "
647 "I<y>), B<pthread_cond_signal> can be used as a slightly more efficient "
648 "alternative to B<pthread_cond_broadcast>. In doubt, use "
649 "B<pthread_cond_broadcast>."
650 msgstr ""
651
652 #. type: TH
653 #: fedora-44 fedora-rawhide
654 #, no-wrap
655 msgid "2025-01-04"
656 msgstr ""
657
658 #. type: TH
659 #: fedora-44 fedora-rawhide
660 #, no-wrap
661 msgid "Linux man-pages 6.13"
662 msgstr ""
663
664 #. type: Plain text
665 #: fedora-44 fedora-rawhide
666 msgid ""
667 "B<pthread_cond_wait> atomically unlocks the I<mutex> (as per "
668 "B<pthread_unlock_mutex>) and waits for the condition variable I<cond> to be "
669 "signaled. The thread execution is suspended and does not consume any CPU "
670 "time until the condition variable is signaled. The I<mutex> must be locked "
671 "by the calling thread on entrance to B<pthread_cond_wait>. Before returning "
672 "to the calling thread, B<pthread_cond_wait> re-acquires I<mutex> (as per "
673 "B<pthread_mutex_lock>)."
674 msgstr ""
675
676 #. type: TH
677 #: mageia-cauldron
678 #, no-wrap
679 msgid "2025-10-16"
680 msgstr ""
681
682 #. type: TH
683 #: mageia-cauldron
684 #, no-wrap
685 msgid "Linux man-pages 6.17"
686 msgstr ""
687
688 #. type: Plain text
689 #: mageia-cauldron
690 msgid ""
691 "B<pthread_cond_wait>() atomically unlocks the I<mutex> (as per "
692 "B<pthread_unlock_mutex>()) and waits for the condition variable I<cond> to "
693 "be signaled. The thread execution is suspended and does not consume any CPU "
694 "time until the condition variable is signaled. The I<mutex> must be locked "
695 "by the calling thread on entrance to B<pthread_cond_wait>(). Before "
696 "returning to the calling thread, B<pthread_cond_wait>() re-acquires "
697 "I<mutex> (as per B<pthread_mutex_lock>())."
698 msgstr ""
699
700 #. type: TH
701 #: opensuse-leap-16-1 opensuse-tumbleweed
702 #, no-wrap
703 msgid "Linux man-pages (unreleased)"
704 msgstr ""