summaryrefslogtreecommitdiffstats
path: root/templates/man3/pthread_cond_init.3.pot
blob: cca6ff5718e5b621c9a0ae72952ee1b1e842a4cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
# SOME DESCRIPTIVE TITLE
# Copyright (C) YEAR Free Software Foundation, Inc.
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2024-06-01 06:13+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#. type: TH
#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron
#: opensuse-tumbleweed
#, no-wrap
msgid "pthread_cond_init"
msgstr ""

#. type: TH
#: archlinux debian-unstable opensuse-tumbleweed
#, no-wrap
msgid "2024-05-19"
msgstr ""

#. type: TH
#: archlinux debian-unstable
#, no-wrap
msgid "Linux man-pages 6.8"
msgstr ""

#. type: SH
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-tumbleweed
#, no-wrap
msgid "NAME"
msgstr ""

#. type: Plain text
#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron
#: opensuse-tumbleweed
msgid ""
"pthread_cond_init, pthread_cond_signal, pthread_cond_broadcast, "
"pthread_cond_wait, pthread_cond_timedwait, pthread_cond_destroy - operations "
"on conditions"
msgstr ""

#. type: SH
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-tumbleweed
#, no-wrap
msgid "SYNOPSIS"
msgstr ""

#. type: Plain text
#: archlinux debian-unstable opensuse-tumbleweed
#, no-wrap
msgid "B<#include E<lt>pthread.hE<gt>>\n"
msgstr ""

#. type: Plain text
#: archlinux debian-unstable opensuse-tumbleweed
#, no-wrap
msgid "B<pthread_cond_t >I<cond>B< = PTHREAD_COND_INITIALIZER;>\n"
msgstr ""

#. type: Plain text
#: archlinux debian-unstable opensuse-tumbleweed
#, no-wrap
msgid ""
"B<int pthread_cond_init(pthread_cond_t *>I<cond>B<,>\n"
"B<                      pthread_condattr_t *>I<cond_attr>B<);>\n"
"B<int pthread_cond_signal(pthread_cond_t *>I<cond>B<);>\n"
"B<int pthread_cond_broadcast(pthread_cond_t *>I<cond>B<);>\n"
"B<int pthread_cond_wait(pthread_cond_t *>I<cond>B<, pthread_mutex_t *>I<mutex>B<);>\n"
"B<int pthread_cond_timedwait(pthread_cond_t *>I<cond>B<, pthread_mutex_t *>I<mutex>B<,>\n"
"B<                      const struct timespec *>I<abstime>B<);>\n"
"B<int pthread_cond_destroy(pthread_cond_t *>I<cond>B<);>\n"
msgstr ""

#. type: SH
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-tumbleweed
#, no-wrap
msgid "DESCRIPTION"
msgstr ""

#. type: Plain text
#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron
#: opensuse-tumbleweed
msgid ""
"A condition (short for ``condition variable'')  is a synchronization device "
"that allows threads to suspend execution and relinquish the processors until "
"some predicate on shared data is satisfied.  The basic operations on "
"conditions are: signal the condition (when the predicate becomes true), and "
"wait for the condition, suspending the thread execution until another thread "
"signals the condition."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-tumbleweed
msgid ""
"A condition variable must always be associated with a mutex, to avoid the "
"race condition where a thread prepares to wait on a condition variable and "
"another thread signals the condition just before the first thread actually "
"waits on it."
msgstr ""

#. type: Plain text
#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron
#: opensuse-tumbleweed
msgid ""
"B<pthread_cond_init> initializes the condition variable I<cond>, using the "
"condition attributes specified in I<cond_attr>, or default attributes if "
"I<cond_attr> is B<NULL>.  The LinuxThreads implementation supports no "
"attributes for conditions, hence the I<cond_attr> parameter is actually "
"ignored."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-tumbleweed
msgid ""
"Variables of type B<pthread_cond_t> can also be initialized statically, "
"using the constant B<PTHREAD_COND_INITIALIZER>."
msgstr ""

#. type: Plain text
#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron
#: opensuse-tumbleweed
msgid ""
"B<pthread_cond_signal> restarts one of the threads that are waiting on the "
"condition variable I<cond>.  If no threads are waiting on I<cond>, nothing "
"happens.  If several threads are waiting on I<cond>, exactly one is "
"restarted, but it is not specified which."
msgstr ""

#. type: Plain text
#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron
#: opensuse-tumbleweed
msgid ""
"B<pthread_cond_broadcast> restarts all the threads that are waiting on the "
"condition variable I<cond>.  Nothing happens if no threads are waiting on "
"I<cond>."
msgstr ""

#. type: Plain text
#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron
#: opensuse-tumbleweed
msgid ""
"B<pthread_cond_wait> atomically unlocks the I<mutex> (as per "
"B<pthread_unlock_mutex>)  and waits for the condition variable I<cond> to be "
"signaled.  The thread execution is suspended and does not consume any CPU "
"time until the condition variable is signaled.  The I<mutex> must be locked "
"by the calling thread on entrance to B<pthread_cond_wait>.  Before returning "
"to the calling thread, B<pthread_cond_wait> re-acquires I<mutex> (as per "
"B<pthread_lock_mutex>)."
msgstr ""

#. type: Plain text
#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron
#: opensuse-tumbleweed
msgid ""
"Unlocking the mutex and suspending on the condition variable is done "
"atomically.  Thus, if all threads always acquire the mutex before signaling "
"the condition, this guarantees that the condition cannot be signaled (and "
"thus ignored)  between the time a thread locks the mutex and the time it "
"waits on the condition variable."
msgstr ""

#. type: Plain text
#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron
#: opensuse-tumbleweed
msgid ""
"B<pthread_cond_timedwait> atomically unlocks I<mutex> and waits on I<cond>, "
"as B<pthread_cond_wait> does, but it also bounds the duration of the wait.  "
"If I<cond> has not been signaled within the amount of time specified by "
"I<abstime>, the mutex I<mutex> is re-acquired and B<pthread_cond_timedwait> "
"returns the error B<ETIMEDOUT>.  The I<abstime> parameter specifies an "
"absolute time, with the same origin as B<time>(2) and B<gettimeofday>(2): an "
"I<abstime> of 0 corresponds to 00:00:00 GMT, January 1, 1970."
msgstr ""

#. type: Plain text
#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron
#: opensuse-tumbleweed
msgid ""
"B<pthread_cond_destroy> destroys a condition variable, freeing the resources "
"it might hold.  No threads must be waiting on the condition variable on "
"entrance to B<pthread_cond_destroy>.  In the LinuxThreads implementation, no "
"resources are associated with condition variables, thus "
"B<pthread_cond_destroy> actually does nothing except checking that the "
"condition has no waiting threads."
msgstr ""

#. type: SH
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-tumbleweed
#, no-wrap
msgid "CANCELLATION"
msgstr ""

#. type: Plain text
#: archlinux debian-unstable fedora-rawhide opensuse-tumbleweed
msgid ""
"B<pthread_cond_wait> and B<pthread_cond_timedwait> are cancelation points.  "
"If a thread is cancelled while suspended in one of these functions, the "
"thread immediately resumes execution, then locks again the I<mutex> argument "
"to B<pthread_cond_wait> and B<pthread_cond_timedwait>, and finally executes "
"the cancelation.  Consequently, cleanup handlers are assured that I<mutex> "
"is locked when they are called."
msgstr ""

#. type: SH
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-tumbleweed
#, no-wrap
msgid "ASYNC-SIGNAL SAFETY"
msgstr ""

#. type: Plain text
#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron
#: opensuse-tumbleweed
msgid ""
"The condition functions are not async-signal safe, and should not be called "
"from a signal handler.  In particular, calling B<pthread_cond_signal> or "
"B<pthread_cond_broadcast> from a signal handler may deadlock the calling "
"thread."
msgstr ""

#. type: SH
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-tumbleweed
#, no-wrap
msgid "RETURN VALUE"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-tumbleweed
msgid ""
"All condition variable functions return 0 on success and a non-zero error "
"code on error."
msgstr ""

#. type: SH
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-tumbleweed
#, no-wrap
msgid "ERRORS"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-tumbleweed
msgid ""
"B<pthread_cond_init>, B<pthread_cond_signal>, B<pthread_cond_broadcast>, and "
"B<pthread_cond_wait> never return an error code."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-tumbleweed
msgid ""
"The B<pthread_cond_timedwait> function returns the following error codes on "
"error:"
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-tumbleweed
#, no-wrap
msgid "B<ETIMEDOUT>"
msgstr ""

#. type: Plain text
#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron
#: opensuse-tumbleweed
msgid ""
"The condition variable was not signaled until the timeout specified by "
"I<abstime>."
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-tumbleweed
#, no-wrap
msgid "B<EINTR>"
msgstr ""

#. type: Plain text
#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron
#: opensuse-tumbleweed
msgid "B<pthread_cond_timedwait> was interrupted by a signal."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-tumbleweed
msgid ""
"The B<pthread_cond_destroy> function returns the following error code on "
"error:"
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-tumbleweed
#, no-wrap
msgid "B<EBUSY>"
msgstr ""

#. type: Plain text
#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron
#: opensuse-tumbleweed
msgid "Some threads are currently waiting on I<cond>."
msgstr ""

#. type: SH
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-tumbleweed
#, no-wrap
msgid "SEE ALSO"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-tumbleweed
msgid ""
"B<pthread_condattr_init>(3), B<pthread_mutex_lock>(3), "
"B<pthread_mutex_unlock>(3), B<gettimeofday>(2), B<nanosleep>(2)."
msgstr ""

#. type: SH
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-tumbleweed
#, no-wrap
msgid "EXAMPLE"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-tumbleweed
msgid ""
"Consider two shared variables I<x> and I<y>, protected by the mutex I<mut>, "
"and a condition variable I<cond> that is to be signaled whenever I<x> "
"becomes greater than I<y>."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-tumbleweed
#, no-wrap
msgid ""
"B<int x,y;\n"
"pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;\n"
"pthread_cond_t cond = PTHREAD_COND_INITIALIZER;>\n"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-tumbleweed
msgid "Waiting until I<x> is greater than I<y> is performed as follows:"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-tumbleweed
#, no-wrap
msgid ""
"B<pthread_mutex_lock(&mut);\n"
"while (x E<lt>= y) {\n"
"        pthread_cond_wait(&cond, &mut);\n"
"}\n"
"/* operate on x and y */\n"
"pthread_mutex_unlock(&mut);>\n"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-tumbleweed
msgid ""
"Modifications on I<x> and I<y> that may cause I<x> to become greater than "
"I<y> should signal the condition if needed:"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-tumbleweed
#, no-wrap
msgid ""
"B<pthread_mutex_lock(&mut);\n"
"/* modify x and y */\n"
"if (x E<gt> y) pthread_cond_broadcast(&cond);\n"
"pthread_mutex_unlock(&mut);>\n"
msgstr ""

#. type: Plain text
#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron
#: opensuse-tumbleweed
msgid ""
"If it can be proved that at most one waiting thread needs to be waken up "
"(for instance, if there are only two threads communicating through I<x> and "
"I<y>), B<pthread_cond_signal> can be used as a slightly more efficient "
"alternative to B<pthread_cond_broadcast>.  In doubt, use "
"B<pthread_cond_broadcast>."
msgstr ""

#. type: Plain text
#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron
#: opensuse-tumbleweed
msgid ""
"To wait for I<x> to become greater than I<y> with a timeout of 5 seconds, do:"
msgstr ""

#. type: Plain text
#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron
#: opensuse-tumbleweed
#, no-wrap
msgid ""
"B<struct timeval now;\n"
"struct timespec timeout;\n"
"int retcode;\n"
"\\&\n"
"pthread_mutex_lock(&mut);\n"
"gettimeofday(&now);\n"
"timeout.tv_sec = now.tv_sec + 5;\n"
"timeout.tv_nsec = now.tv_usec * 1000;\n"
"retcode = 0;\n"
"while (x E<lt>= y && retcode != ETIMEDOUT) {\n"
"        retcode = pthread_cond_timedwait(&cond, &mut, &timeout);\n"
"}\n"
"if (retcode == ETIMEDOUT) {\n"
"        /* timeout occurred */\n"
"} else {\n"
"        /* operate on x and y */\n"
"}\n"
"pthread_mutex_unlock(&mut);>\n"
msgstr ""

#. type: TH
#: debian-bookworm
#, no-wrap
msgid "PTHREAD_COND"
msgstr ""

#. type: TH
#: debian-bookworm
#, no-wrap
msgid "LinuxThreads"
msgstr ""

#. type: Plain text
#: debian-bookworm
msgid ""
"pthread_cond_init, pthread_cond_destroy, pthread_cond_signal, "
"pthread_cond_broadcast, pthread_cond_wait, pthread_cond_timedwait - "
"operations on conditions"
msgstr ""

#. type: Plain text
#: debian-bookworm fedora-40 fedora-rawhide mageia-cauldron
msgid "B<#include E<lt>pthread.hE<gt>>"
msgstr ""

#. type: Plain text
#: debian-bookworm fedora-40 fedora-rawhide mageia-cauldron
msgid "B<pthread_cond_t >I<cond>B< = PTHREAD_COND_INITIALIZER;>"
msgstr ""

#. type: Plain text
#: debian-bookworm
msgid ""
"B<int pthread_cond_init(pthread_cond_t *>I<cond>B<, pthread_condattr_t "
"*>I<cond_attr>B<);>"
msgstr ""

#. type: Plain text
#: debian-bookworm
msgid "B<int pthread_cond_signal(pthread_cond_t *>I<cond>B<);>"
msgstr ""

#. type: Plain text
#: debian-bookworm
msgid "B<int pthread_cond_broadcast(pthread_cond_t *>I<cond>B<);>"
msgstr ""

#. type: Plain text
#: debian-bookworm
msgid ""
"B<int pthread_cond_wait(pthread_cond_t *>I<cond>B<, pthread_mutex_t "
"*>I<mutex>B<);>"
msgstr ""

#. type: Plain text
#: debian-bookworm
msgid ""
"B<int pthread_cond_timedwait(pthread_cond_t *>I<cond>B<, pthread_mutex_t "
"*>I<mutex>B<, const struct timespec *>I<abstime>B<);>"
msgstr ""

#. type: Plain text
#: debian-bookworm
msgid "B<int pthread_cond_destroy(pthread_cond_t *>I<cond>B<);>"
msgstr ""

#. type: Plain text
#: debian-bookworm
msgid ""
"A condition (short for ``condition variable'') is a synchronization device "
"that allows threads to suspend execution and relinquish the processors until "
"some predicate on shared data is satisfied. The basic operations on "
"conditions are: signal the condition (when the predicate becomes true), and "
"wait for the condition, suspending the thread execution until another thread "
"signals the condition."
msgstr ""

#. type: Plain text
#: debian-bookworm
msgid ""
"B<pthread_cond_init> initializes the condition variable I<cond>, using the "
"condition attributes specified in I<cond_attr>, or default attributes if "
"I<cond_attr> is B<NULL>. The LinuxThreads implementation supports no "
"attributes for conditions, hence the I<cond_attr> parameter is actually "
"ignored."
msgstr ""

#. type: Plain text
#: debian-bookworm
msgid ""
"B<pthread_cond_signal> restarts one of the threads that are waiting on the "
"condition variable I<cond>. If no threads are waiting on I<cond>, nothing "
"happens. If several threads are waiting on I<cond>, exactly one is "
"restarted, but it is not specified which."
msgstr ""

#. type: Plain text
#: debian-bookworm
msgid ""
"B<pthread_cond_broadcast> restarts all the threads that are waiting on the "
"condition variable I<cond>. Nothing happens if no threads are waiting on "
"I<cond>."
msgstr ""

#. type: Plain text
#: debian-bookworm
msgid ""
"B<pthread_cond_wait> atomically unlocks the I<mutex> (as per "
"B<pthread_unlock_mutex>) and waits for the condition variable I<cond> to be "
"signaled. The thread execution is suspended and does not consume any CPU "
"time until the condition variable is signaled. The I<mutex> must be locked "
"by the calling thread on entrance to B<pthread_cond_wait>. Before returning "
"to the calling thread, B<pthread_cond_wait> re-acquires I<mutex> (as per "
"B<pthread_lock_mutex>)."
msgstr ""

#. type: Plain text
#: debian-bookworm
msgid ""
"Unlocking the mutex and suspending on the condition variable is done "
"atomically. Thus, if all threads always acquire the mutex before signaling "
"the condition, this guarantees that the condition cannot be signaled (and "
"thus ignored) between the time a thread locks the mutex and the time it "
"waits on the condition variable."
msgstr ""

#. type: Plain text
#: debian-bookworm
msgid ""
"B<pthread_cond_timedwait> atomically unlocks I<mutex> and waits on I<cond>, "
"as B<pthread_cond_wait> does, but it also bounds the duration of the wait. "
"If I<cond> has not been signaled within the amount of time specified by "
"I<abstime>, the mutex I<mutex> is re-acquired and B<pthread_cond_timedwait> "
"returns the error B<ETIMEDOUT>.  The I<abstime> parameter specifies an "
"absolute time, with the same origin as B<time>(2) and B<gettimeofday>(2): an "
"I<abstime> of 0 corresponds to 00:00:00 GMT, January 1, 1970."
msgstr ""

#. type: Plain text
#: debian-bookworm
msgid ""
"B<pthread_cond_destroy> destroys a condition variable, freeing the resources "
"it might hold. No threads must be waiting on the condition variable on "
"entrance to B<pthread_cond_destroy>. In the LinuxThreads implementation, no "
"resources are associated with condition variables, thus "
"B<pthread_cond_destroy> actually does nothing except checking that the "
"condition has no waiting threads."
msgstr ""

#. type: Plain text
#: debian-bookworm
msgid ""
"B<pthread_cond_wait> and B<pthread_cond_timedwait> are cancellation points. "
"If a thread is cancelled while suspended in one of these functions, the "
"thread immediately resumes execution, then locks again the I<mutex> argument "
"to B<pthread_cond_wait> and B<pthread_cond_timedwait>, and finally executes "
"the cancellation.  Consequently, cleanup handlers are assured that I<mutex> "
"is locked when they are called."
msgstr ""

#. type: Plain text
#: debian-bookworm
msgid ""
"The condition functions are not async-signal safe, and should not be called "
"from a signal handler. In particular, calling B<pthread_cond_signal> or "
"B<pthread_cond_broadcast> from a signal handler may deadlock the calling "
"thread."
msgstr ""

#. type: Plain text
#: debian-bookworm
msgid ""
"the condition variable was not signaled until the timeout specified by "
"I<abstime>"
msgstr ""

#. type: Plain text
#: debian-bookworm
msgid "B<pthread_cond_timedwait> was interrupted by a signal"
msgstr ""

#. type: Plain text
#: debian-bookworm
msgid "some threads are currently waiting on I<cond>."
msgstr ""

#. type: SH
#: debian-bookworm
#, no-wrap
msgid "AUTHOR"
msgstr ""

#. type: Plain text
#: debian-bookworm
msgid "Xavier Leroy E<lt>Xavier.Leroy@inria.frE<gt>"
msgstr ""

#. type: Plain text
#: debian-bookworm
msgid ""
"If it can be proved that at most one waiting thread needs to be waken up "
"(for instance, if there are only two threads communicating through I<x> and "
"I<y>), B<pthread_cond_signal> can be used as a slightly more efficient "
"alternative to B<pthread_cond_broadcast>. In doubt, use "
"B<pthread_cond_broadcast>."
msgstr ""

#. type: Plain text
#: debian-bookworm
msgid ""
"To wait for I<x> to becomes greater than I<y> with a timeout of 5 seconds, "
"do:"
msgstr ""

#. type: Plain text
#: debian-bookworm
#, no-wrap
msgid ""
"B<struct timeval now;\n"
"struct timespec timeout;\n"
"int retcode;>\n"
msgstr ""

#. type: Plain text
#: debian-bookworm
#, no-wrap
msgid ""
"B<pthread_mutex_lock(&mut);\n"
"gettimeofday(&now);\n"
"timeout.tv_sec = now.tv_sec + 5;\n"
"timeout.tv_nsec = now.tv_usec * 1000;\n"
"retcode = 0;\n"
"while (x E<lt>= y && retcode != ETIMEDOUT) {\n"
"        retcode = pthread_cond_timedwait(&cond, &mut, &timeout);\n"
"}\n"
"if (retcode == ETIMEDOUT) {\n"
"        /* timeout occurred */\n"
"} else {\n"
"        /* operate on x and y */\n"
"}\n"
"pthread_mutex_unlock(&mut);>\n"
msgstr ""

#. type: TH
#: fedora-40 mageia-cauldron
#, no-wrap
msgid "2023-10-31"
msgstr ""

#. type: TH
#: fedora-40 mageia-cauldron
#, no-wrap
msgid "Linux man-pages 6.06"
msgstr ""

#. type: Plain text
#: fedora-40 fedora-rawhide mageia-cauldron
msgid ""
"B<int pthread_cond_init(pthread_cond_t *>I<cond>B<, pthread_condattr_t "
"*>I<cond_attr>B<);> B<int pthread_cond_signal(pthread_cond_t *>I<cond>B<);> "
"B<int pthread_cond_broadcast(pthread_cond_t *>I<cond>B<);> B<int "
"pthread_cond_wait(pthread_cond_t *>I<cond>B<, pthread_mutex_t *>I<mutex>B<);"
"> B<int pthread_cond_timedwait(pthread_cond_t *>I<cond>B<, pthread_mutex_t "
"*>I<mutex>B<, const struct timespec *>I<abstime>B<);> B<int "
"pthread_cond_destroy(pthread_cond_t *>I<cond>B<);>"
msgstr ""

#. type: Plain text
#: fedora-40 mageia-cauldron
msgid ""
"B<pthread_cond_wait> and B<pthread_cond_timedwait> are cancellation points.  "
"If a thread is cancelled while suspended in one of these functions, the "
"thread immediately resumes execution, then locks again the I<mutex> argument "
"to B<pthread_cond_wait> and B<pthread_cond_timedwait>, and finally executes "
"the cancellation.  Consequently, cleanup handlers are assured that I<mutex> "
"is locked when they are called."
msgstr ""

#. type: TH
#: fedora-rawhide
#, no-wrap
msgid "2024-02-26"
msgstr ""

#. type: TH
#: fedora-rawhide
#, no-wrap
msgid "Linux man-pages 6.7"
msgstr ""

#. type: TH
#: opensuse-tumbleweed
#, no-wrap
msgid "Linux man-pages (unreleased)"
msgstr ""