-
Notifications
You must be signed in to change notification settings - Fork 0
/
pthread.3
8312 lines (8312 loc) · 272 KB
/
pthread.3
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
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
.\" Automatically generated by Pod::Man 2.1801 (Pod::Simple 3.05)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.ie \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.el \{\
. de IX
..
.\}
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title ".::pthread 3"
.TH .::pthread 3 "pthsem 2.0.8" "2.0.8" "POSIX Threading API of pthsem"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
\&\fBpthread\fR \- \s-1POSIX\s0.1c Threading \s-1API\s0 of \s-1GNU\s0 Pth
.SH "VERSION"
.IX Header "VERSION"
pthsem \s-12.0.8\s0
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
\&\fBApplication Makefiles:\fR
.PP
.Vb 4
\& # manually
\& CFLAGS=\-I/path/to/pth/include
\& LDFLAGS=\-L/path/to/pth/lib
\& LIBS=\-lpthread
\&
\& # automatically
\& CFLAGS=\`pthread\-config \-\-cflags\`
\& LDFLAGS=\`pthread\-config \-\-ldflags\`
\& LIBS=\`pthread\-config \-\-libs\`
.Ve
.PP
\&\fBApplication source files:\fR
.PP
.Vb 1
\& #include <pthread.h>
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
.SS "Overview"
.IX Subsection "Overview"
This is the \s-1IEEE\s0 Std. 1003.1c (\*(L"\s-1POSIX\s0.1c\*(R") conforming threading \s-1API\s0 of
\&\s-1GNU\s0 Portable Threads (\fBPth\fR). This \s-1API\s0 is commonly known as ``\fI\s-1POSIX\s0
threads\fR'' or in short ``\fIPthreads\fR''. It is provided by \fBPth\fR with
the intention of backward compatibility to existing multithreaded
applications. It is implemented by mapping the various Pthread \s-1API\s0
functions to the corresponding native \fBPth\fR \s-1API\s0 functions.
.SS "Supported Features"
.IX Subsection "Supported Features"
The following defined feature macros in \f(CW\*(C`pthread.h\*(C'\fR indicate supported
features:
.PP
.Vb 3
\& #define _POSIX_THREADS
\& #define _POSIX_THREAD_ATTR_STACKADDR
\& #define _POSIX_THREAD_ATTR_STACKSIZE
.Ve
.PP
The following undefined feature macros in \f(CW\*(C`pthread.h\*(C'\fR indicate (still)
unsupported features:
.PP
.Vb 5
\& #undef _POSIX_THREAD_PRIORITY_SCHEDULING
\& #undef _POSIX_THREAD_PRIO_INHERIT
\& #undef _POSIX_THREAD_PRIO_PROTECT
\& #undef _POSIX_THREAD_PROCESS_SHARED
\& #undef _POSIX_THREAD_SAFE_FUNCTIONS
.Ve
.SS "Notes"
.IX Subsection "Notes"
A few notes which you should keep in mind when working with the \fBPth\fR Pthread
\&\s-1API\s0.
.IP "\fBNon-Preemptive Scheduling\fR" 4
.IX Item "Non-Preemptive Scheduling"
First you have to always remember when working with this Pthread library that
it uses non-preemptive scheduling, because it is directly based on \fBPth\fR
(\fBPth\fR for portability reasons is a pure non-preemptive thread scheduling
system). So there is no implicit yielding of execution control unless you can
\&\f(CW\*(C`pthread_*\*(C'\fR functions which could block and you cannot expect granular
concurrency in your application, of course. Nevertheless the responsiveness
and concurrency of an event driven application is increased greatly because of
overlapping I/O.
.IP "\fBConflicts with Vendor Implementation\fR" 4
.IX Item "Conflicts with Vendor Implementation"
There can be a conflict between the \fBPth\fR \f(CW\*(C`pthread.h\*(C'\fR header and a possibly
existing vendor \f(CW\*(C`/usr/include/pthread.h\*(C'\fR header which was implicitly included
by some standard vendor headers (like \f(CW\*(C`/usr/include/unistd.h\*(C'\fR). When this
occurs try to ``\f(CW\*(C`#define\*(C'\fR'' header-dependent values which prevent the
inclusion of the vendor header.
.SS "Further Reading"
.IX Subsection "Further Reading"
There is ``\fIThe Single \s-1UNIX\s0 Specification, Version
2 \- Threads\fR'', from \fIThe Open Group\fR of 1997 under
http://www.opengroup.org/onlinepubs/007908799/xsh/threads.html. This is
a very complete publically available description of the Pthread \s-1API\s0. For
convinience reasons, a translated copy of these freely available \s-1HTML\s0
pages are appended to this manpage below. These are \fICopyright (C) 1997
The Open Group\fR.
.PP
Second, you can also buy the official standard from \s-1IEEE\s0. It is the \s-1IEEE\s0
\&\s-1POSIX\s0 1003.1c\-1995 standard (also known as \s-1ISO/IEC\s0 9945\-1:1996), which
is available as part of the \s-1ANSI/IEEE\s0 1003.1, 1996 edition, standard.
.PP
Finally you can look at the files \f(CW\*(C`pthread.c\*(C'\fR and \f(CW\*(C`pthread.h\*(C'\fR in the \fBPth\fR
source tree for details of the implementation, of course.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fIpthread\-config\fR\|(1), \fIpth\fR\|(3).
.SH "AUTHOR"
.IX Header "AUTHOR"
.Vb 3
\& Ralf S. Engelschall
\& www.engelschall.com
.Ve
.SH "_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_"
.IX Header "______________________________________________________________________"
.SH "NAME"
\&\fBpthread.h\fR \- threads
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
#include <pthread.h>
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
The
\&\fI<pthread.h\fR>
header defines the following symbols:
.PP
.Vb 10
\& PTHREAD_CANCEL_ASYNCHRONOUS
\& PTHREAD_CANCEL_ENABLE
\& PTHREAD_CANCEL_DEFERRED
\& PTHREAD_CANCEL_DISABLE
\& PTHREAD_CANCELED
\& PTHREAD_COND_INITIALIZER
\& PTHREAD_CREATE_DETACHED
\& PTHREAD_CREATE_JOINABLE
\& PTHREAD_EXPLICIT_SCHED
\& PTHREAD_INHERIT_SCHED
\& PTHREAD_MUTEX_DEFAULT
\& PTHREAD_MUTEX_ERRORCHECK
\& PTHREAD_MUTEX_NORMAL
\& PTHREAD_MUTEX_INITIALIZER
\& PTHREAD_MUTEX_RECURSIVE
\& PTHREAD_ONCE_INIT
\& PTHREAD_PRIO_INHERIT
\& PTHREAD_PRIO_NONE
\& PTHREAD_PRIO_PROTECT
\& PTHREAD_PROCESS_SHARED
\& PTHREAD_PROCESS_PRIVATE
\& PTHREAD_RWLOCK_INITIALIZER
\& PTHREAD_SCOPE_PROCESS
\& PTHREAD_SCOPE_SYSTEM
.Ve
.PP
The \fBpthread_attr_t\fR, \fBpthread_cond_t\fR, \fBpthread_condattr_t\fR,
\&\fBpthread_key_t\fR, \fBpthread_mutex_t\fR, \fBpthread_mutexattr_t\fR,
\&\fBpthread_once_t\fR, \fBpthread_rwlock_t\fR, \fBpthread_rwlockattr_t\fR and
\&\fBpthread_t\fR types are defined as described in \fI<sys/types.h\fR>.
.PP
The following are declared as functions and may also be declared as
macros. Function prototypes must be provided for use with an \s-1ISO\s0 C
compiler.
.PP
.Vb 10
\& int pthread_attr_destroy(pthread_attr_t *);
\& int pthread_attr_getdetachstate(const pthread_attr_t *, int *);
\& int pthread_attr_getguardsize(const pthread_attr_t *, size_t *);
\& int pthread_attr_getinheritsched(const pthread_attr_t *, int *);
\& int pthread_attr_getschedparam(const pthread_attr_t *, struct sched_param *);
\& int pthread_attr_getschedpolicy(const pthread_attr_t *, int *);
\& int pthread_attr_getscope(const pthread_attr_t *, int *);
\& int pthread_attr_getstackaddr(const pthread_attr_t *, void **);
\& int pthread_attr_getstacksize(const pthread_attr_t *, size_t *);
\& int pthread_attr_init(pthread_attr_t *);
\& int pthread_attr_setdetachstate(pthread_attr_t *, int);
\& int pthread_attr_setguardsize(pthread_attr_t *, size_t);
\& int pthread_attr_setinheritsched(pthread_attr_t *, int);
\& int pthread_attr_setschedparam(pthread_attr_t *, const struct sched_param *);
\& int pthread_attr_setschedpolicy(pthread_attr_t *, int);
\& int pthread_attr_setscope(pthread_attr_t *, int);
\& int pthread_attr_setstackaddr(pthread_attr_t *, void *);
\& int pthread_attr_setstacksize(pthread_attr_t *, size_t);
\& int pthread_cancel(pthread_t);
\& void pthread_cleanup_push(void*), void *);
\& void pthread_cleanup_pop(int);
\& int pthread_cond_broadcast(pthread_cond_t *);
\& int pthread_cond_destroy(pthread_cond_t *);
\& int pthread_cond_init(pthread_cond_t *, const pthread_condattr_t *);
\& int pthread_cond_signal(pthread_cond_t *);
\& int pthread_cond_timedwait(pthread_cond_t *, pthread_mutex_t *, const struct timespec *);
\& int pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *);
\& int pthread_condattr_destroy(pthread_condattr_t *);
\& int pthread_condattr_getpshared(const pthread_condattr_t *, int *);
\& int pthread_condattr_init(pthread_condattr_t *);
\& int pthread_condattr_setpshared(pthread_condattr_t *, int);
\& int pthread_create(pthread_t *, const pthread_attr_t *, void *(*)(void *), void *);
\& int pthread_detach(pthread_t);
\& int pthread_equal(pthread_t, pthread_t);
\& void pthread_exit(void *);
\& int pthread_getconcurrency(void);
\& int pthread_getschedparam(pthread_t, int *, struct sched_param *);
\& void *pthread_getspecific(pthread_key_t);
\& int pthread_join(pthread_t, void **);
\& int pthread_key_create(pthread_key_t *, void (*)(void *));
\& int pthread_key_delete(pthread_key_t);
\& int pthread_mutex_destroy(pthread_mutex_t *);
\& int pthread_mutex_getprioceiling(const pthread_mutex_t *, int *);
\& int pthread_mutex_init(pthread_mutex_t *, const pthread_mutexattr_t *);
\& int pthread_mutex_lock(pthread_mutex_t *);
\& int pthread_mutex_setprioceiling(pthread_mutex_t *, int, int *);
\& int pthread_mutex_trylock(pthread_mutex_t *);
\& int pthread_mutex_unlock(pthread_mutex_t *);
\& int pthread_mutexattr_destroy(pthread_mutexattr_t *);
\& int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *, int *);
\& int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *, int *);
\& int pthread_mutexattr_getpshared(const pthread_mutexattr_t *, int *);
\& int pthread_mutexattr_gettype(const pthread_mutexattr_t *, int *);
\& int pthread_mutexattr_init(pthread_mutexattr_t *);
\& int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int);
\& int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int);
\& int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int);
\& int pthread_mutexattr_settype(pthread_mutexattr_t *, int);
\& int pthread_once(pthread_once_t *, void (*)(void));
\& int pthread_rwlock_destroy(pthread_rwlock_t *);
\& int pthread_rwlock_init(pthread_rwlock_t *, const pthread_rwlockattr_t *);
\& int pthread_rwlock_rdlock(pthread_rwlock_t *);
\& int pthread_rwlock_tryrdlock(pthread_rwlock_t *);
\& int pthread_rwlock_trywrlock(pthread_rwlock_t *);
\& int pthread_rwlock_unlock(pthread_rwlock_t *);
\& int pthread_rwlock_wrlock(pthread_rwlock_t *);
\& int pthread_rwlockattr_destroy(pthread_rwlockattr_t *);
\& int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *, int *);
\& int pthread_rwlockattr_init(pthread_rwlockattr_t *);
\& int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int);
\& pthread_t pthread_self(void);
\& int pthread_setcancelstate(int, int *);
\& int pthread_setcanceltype(int, int *);
\& int pthread_setconcurrency(int);
\& int pthread_setschedparam(pthread_t, int, const struct sched_param *);
\& int pthread_setspecific(pthread_key_t, const void *);
\& void pthread_testcancel(void);
.Ve
.PP
Inclusion of the \fI<pthread.h\fR> header will make visible symbols defined
in the headers \fI<sched.h\fR> and \fI<time.h\fR>.
.SH "APPLICATION USAGE"
.IX Header "APPLICATION USAGE"
An interpretation request has been filed with \s-1IEEE\s0 \s-1PASC\s0 concerning
requirements for visibility of symbols in this header.
.SH "FUTURE DIRECTIONS"
.IX Header "FUTURE DIRECTIONS"
None.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fI\fIpthread_attr_init()\fI\fR,
\&\fI\fIpthread_attr_getguardsize()\fI\fR,
\&\fI\fIpthread_attr_setscope()\fI\fR,
\&\fI\fIpthread_cancel()\fI\fR,
\&\fI\fIpthread_cleanup_push()\fI\fR,
\&\fI\fIpthread_cond_init()\fI\fR,
\&\fI\fIpthread_cond_signal()\fI\fR,
\&\fI\fIpthread_cond_wait()\fI\fR,
\&\fI\fIpthread_condattr_init()\fI\fR,
\&\fI\fIpthread_create()\fI\fR,
\&\fI\fIpthread_detach()\fI\fR,
\&\fI\fIpthread_equal()\fI\fR,
\&\fI\fIpthread_exit()\fI\fR,
\&\fI\fIpthread_getconcurrency()\fI\fR,
\&\fI\fIpthread_getschedparam()\fI\fR,
\&\fI\fIpthread_join()\fI\fR,
\&\fI\fIpthread_key_create()\fI\fR,
\&\fI\fIpthread_key_delete()\fI\fR,
\&\fI\fIpthread_mutex_init()\fI\fR,
\&\fI\fIpthread_mutex_lock()\fI\fR,
\&\fI\fIpthread_mutex_setprioceiling()\fI\fR,
\&\fI\fIpthread_mutexattr_init()\fI\fR,
\&\fI\fIpthread_mutexattr_gettype()\fI\fR,
\&\fI\fIpthread_mutexattr_setprotocol()\fI\fR,
\&\fI\fIpthread_once()\fI\fR,
\&\fI\fIpthread_self()\fI\fR,
\&\fI\fIpthread_setcancelstate()\fI\fR,
\&\fI\fIpthread_setspecific()\fI\fR,
\&\fI\fIpthread_rwlock_init()\fI\fR,
\&\fI\fIpthread_rwlock_rdlock()\fI\fR,
\&\fI\fIpthread_rwlock_unlock()\fI\fR,
\&\fI\fIpthread_rwlock_wrlock()\fI\fR,
\&\fI\fIpthread_rwlockattr_init()\fI\fR,
\&\fI<sched.h\fR>,
\&\fI<time.h\fR>.
.SH "_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_"
.IX Header "______________________________________________________________________"
.SH "NAME"
\&\fBpthread_atfork\fR \- register fork handlers
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
#include <sys/types.h>
.PP
#include <unistd.h>
.PP
int pthread_atfork(void (*\fIprepare\fR)(void), void (*\fIparent\fR)(void),
void (*\fIchild\fR)(void));
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
The \fI\fIpthread_atfork()\fI\fR function declares fork handlers to be called
before and after \fI\fIfork()\fI\fR, in the context of the thread that called
\&\fI\fIfork()\fI\fR. The \fIprepare\fR fork handler is called before \fI\fIfork()\fI\fR
processing commences. The \fIparent\fR fork handle is called after
\&\fI\fIfork()\fI\fR processing completes in the parent process. The \fIchild\fR fork
handler is called after \fI\fIfork()\fI\fR processing completes in the child
process. If no handling is desired at one or more of these three points,
the corresponding fork handler address(es) may be set to \s-1NULL\s0.
.PP
The order of calls to \fI\fIpthread_atfork()\fI\fR is significant. The \fIparent\fR
and \fIchild\fR fork handlers are called in the order in which they were
established by calls to \fI\fIpthread_atfork()\fI\fR. The \fIprepare\fR fork
handlers are called in the opposite order.
.SH "RETURN VALUE"
.IX Header "RETURN VALUE"
Upon successful completion, \fI\fIpthread_atfork()\fI\fR returns a value of zero.
Otherwise, an error number is returned to indicate the error.
.SH "ERRORS"
.IX Header "ERRORS"
The \fI\fIpthread_atfork()\fI\fR function will fail if:
.IP "[\s-1ENOMEM\s0]" 4
.IX Item "[ENOMEM]"
Insufficient table space exists to record the fork handler addresses.
.PP
The \fI\fIpthread_atfork()\fI\fR function will not return an error code of
[\s-1EINTR\s0].
.SH "EXAMPLES"
.IX Header "EXAMPLES"
None.
.SH "APPLICATION USAGE"
.IX Header "APPLICATION USAGE"
None.
.SH "FUTURE DIRECTIONS"
.IX Header "FUTURE DIRECTIONS"
None.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fI\fIatexit()\fI\fR,
\&\fI\fIfork()\fI\fR,
\&\fI<sys/types.h\fR>
.SH "_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_"
.IX Header "______________________________________________________________________"
.SH "NAME"
\&\fBpthread_attr_init,\fR \fBpthread_attr_destroy\fR
\&\- initialise and destroy threads attribute object
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
#include <pthread.h>
.PP
int pthread_attr_init(pthread_attr_t *\fIattr\fR);
.PP
int pthread_attr_destroy(pthread_attr_t *\fIattr\fR);
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
The function \fI\fIpthread_attr_init()\fI\fR initialises a thread attributes
object \fIattr\fR with the default value for all of the individual
attributes used by a given implementation.
.PP
The resulting attribute object (possibly modified by setting individual
attribute values), when used by \fI\fIpthread_create()\fI\fR, defines the
attributes of the thread created. A single attributes object can be used
in multiple simultaneous calls to \fI\fIpthread_create()\fI\fR.
.PP
The \fI\fIpthread_attr_destroy()\fI\fR function is used to destroy a thread
attributes object. An implementation may cause \fI\fIpthread_attr_destroy()\fI\fR
to set \fIattr\fR to an implementation-dependent invalid value. The
behaviour of using the attribute after it has been destroyed is
undefined.
.SH "RETURN VALUE"
.IX Header "RETURN VALUE"
Upon successful completion, \fI\fIpthread_attr_init()\fI\fR and
\&\fI\fIpthread_attr_destroy()\fI\fR return a value of 0. Otherwise, an error
number is returned to indicate the error.
.SH "ERRORS"
.IX Header "ERRORS"
The \fI\fIpthread_attr_init()\fI\fR function will fail if:
.IP "[\s-1ENOMEM\s0]" 4
.IX Item "[ENOMEM]"
Insufficient memory exists to initialise the thread attributes object.
.PP
These functions will not return an error code of [\s-1EINTR\s0].
.SH "EXAMPLES"
.IX Header "EXAMPLES"
None.
.SH "APPLICATION USAGE"
.IX Header "APPLICATION USAGE"
None.
.SH "FUTURE DIRECTIONS"
.IX Header "FUTURE DIRECTIONS"
None.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fI\fIpthread_attr_setstackaddr()\fI\fR,
\&\fI\fIpthread_attr_setstacksize()\fI\fR,
\&\fI\fIpthread_attr_setdetachstate()\fI\fR,
\&\fI\fIpthread_create()\fI\fR,
\&\fI<pthread.h\fR>.
.SH "_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_"
.IX Header "______________________________________________________________________"
.SH "NAME"
\&\fBpthread_attr_setdetachstate,\fR \fBpthread_attr_getdetachstate\fR
\&\- set and get detachstate attribute
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
#include <pthread.h>
.PP
int pthread_attr_setdetachstate(pthread_attr_t *\fIattr\fR, int \fIdetachstate\fR);
.PP
int pthread_attr_getdetachstate(const pthread_attr_t *\fIattr\fR, int *\fIdetachstate\fR);
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
The \fIdetachstate\fR attribute controls whether the thread is created in a
detached state. If the thread is created detached, then use of the \s-1ID\s0 of
the newly created thread by the \fI\fIpthread_detach()\fI\fR or \fI\fIpthread_join()\fI\fR
function is an error.
.PP
The \fI\fIpthread_attr_setdetachstate()\fI\fR and
\&\fI\fIpthread_attr_getdetachstate()\fI\fR, respectively, set and get the
\&\fIdetachstate\fR attribute in the \fIattr\fR object.
.PP
The \fIdetachstate\fR can be set to either \s-1PTHREAD_CREATE_DETACHED\s0 or
\&\s-1PTHREAD_CREATE_JOINABLE\s0. A value of \s-1PTHREAD_CREATE_DETACHED\s0 causes
all threads created with \fIattr\fR to be in the detached state, whereas
using a value of \s-1PTHREAD_CREATE_JOINABLE\s0 causes all threads created
with \fIattr\fR to be in the joinable state. The default value of the
\&\fIdetachstate\fR attribute is \s-1PTHREAD_CREATE_JOINABLE\s0 .
.SH "RETURN VALUE"
.IX Header "RETURN VALUE"
Upon successful completion, \fI\fIpthread_attr_setdetachstate()\fI\fR and
\&\fI\fIpthread_attr_getdetachstate()\fI\fR return a value of 0. Otherwise, an
error number is returned to indicate the error.
.PP
The \fI\fIpthread_attr_getdetachstate()\fI\fR function stores the value of the
\&\fIdetachstate\fR attribute in \fIdetachstate\fR if successful.
.SH "ERRORS"
.IX Header "ERRORS"
The \fI\fIpthread_attr_setdetachstate()\fI\fR function will fail if:
.IP "[\s-1EINVAL\s0]" 4
.IX Item "[EINVAL]"
The value of \fIdetachstate\fR was not valid
.PP
These functions will not return an error code of [\s-1EINTR\s0].
.SH "EXAMPLES"
.IX Header "EXAMPLES"
None.
.SH "APPLICATION USAGE"
.IX Header "APPLICATION USAGE"
None.
.SH "FUTURE DIRECTIONS"
.IX Header "FUTURE DIRECTIONS"
None.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fI\fIpthread_attr_init()\fI\fR,
\&\fI\fIpthread_attr_setstackaddr()\fI\fR,
\&\fI\fIpthread_attr_setstacksize()\fI\fR,
\&\fI\fIpthread_create()\fI\fR,
\&\fI<pthread.h\fR>.
.SH "_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_"
.IX Header "______________________________________________________________________"
.SH "NAME"
\&\fBpthread_attr_getguardsize,\fR \fBpthread_attr_setguardsize\fR \-
get or set the thread guardsize attribute
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
#include <pthread.h>
.PP
int pthread_attr_getguardsize(const pthread_attr_t \fI*attr\fR, size_t
\&\fI*guardsize\fR); int pthread_attr_setguardsize(pthread_attr_t \fI*attr\fR,
size_t \fIguardsize\fR);
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
The \fIguardsize\fR attribute controls the size of the guard area for the
created thread's stack. The \fIguardsize\fR attribute provides protection
against overflow of the stack pointer. If a thread's stack is created
with guard protection, the implementation allocates extra memory at the
overflow end of the stack as a buffer against stack overflow of the
stack pointer. If an application overflows into this buffer an error
results (possibly in a \s-1SIGSEGV\s0 signal being delivered to the thread).
.PP
The \fIguardsize\fR attribute is provided to the application
for two reasons:
.IP "1." 4
Overflow protection can potentially result in wasted system resources.
An application that creates a large number of threads, and which knows
its threads will never overflow their stack, can save system resources
by turning off guard areas.
.IP "2." 4
When threads allocate large data structures on the stack,
large guard areas may be needed to detect stack overflow.
.PP
The \fI\fIpthread_attr_getguardsize()\fI\fR function gets the \fIguardsize\fR
attribute in the \fIattr\fR object. This attribute is returned in the
\&\fIguardsize\fR parameter.
.PP
The \fI\fIpthread_attr_setguardsize()\fI\fR function sets the \fIguardsize\fR
attribute in the \fIattr\fR object. The new value of this attribute is
obtained from the \fIguardsize\fR parameter. If \fIguardsize\fR is zero,
a guard area will not be provided for threads created with \fIattr\fR.
If \fIguardsize\fR is greater than zero, a guard area of at least size
\&\fIguardsize\fR bytes is provided for each thread created with \fIattr\fR.
.PP
A conforming implementation is permitted to round up the value
contained in \fIguardsize\fR to a multiple of the configurable system
variable \s-1PAGESIZE\s0 (see \fI<sys/mman.h\fR>). If an implementation rounds
up the value of \fIguardsize\fR to a multiple of \s-1PAGESIZE\s0, a call to
\&\fI\fIpthread_attr_getguardsize()\fI\fR specifying \fIattr\fR will store in the
\&\fIguardsize\fR parameter the guard size specified by the previous
\&\fI\fIpthread_attr_setguardsize()\fI\fR function call.
.PP
The default value of the \fIguardsize\fR attribute is \s-1PAGESIZE\s0 bytes. The
actual value of \s-1PAGESIZE\s0 is implementation-dependent and may not be the
same on all implementations.
.PP
If the \fIstackaddr\fR attribute has been set (that is, the caller is
allocating and managing its own thread stacks), the \fIguardsize\fR
attribute is ignored and no protection will be provided by the
implementation. It is the responsibility of the application to manage
stack overflow along with stack allocation and management in this case.
.SH "RETURN VALUE"
.IX Header "RETURN VALUE"
If successful, the \fI\fIpthread_attr_getguardsize()\fI\fR and
\&\fI\fIpthread_attr_setguardsize()\fI\fR functions return zero. Otherwise, an
error number is returned to indicate the error.
.SH "ERRORS"
.IX Header "ERRORS"
The \fI\fIpthread_attr_getguardsize()\fI\fR and \fI\fIpthread_attr_setguardsize()\fI\fR
functions will fail if:
.IP "[\s-1EINVAL\s0]" 4
.IX Item "[EINVAL]"
The attribute \fIattr\fR is invalid.
.IP "[\s-1EINVAL\s0]" 4
.IX Item "[EINVAL]"
The parameter \fIguardsize\fR is invalid.
.IP "[\s-1EINVAL\s0]" 4
.IX Item "[EINVAL]"
The parameter \fIguardsize\fR contains an invalid value.
.SH "EXAMPLES"
.IX Header "EXAMPLES"
None.
.SH "APPLICATION USAGE"
.IX Header "APPLICATION USAGE"
None.
.SH "FUTURE DIRECTIONS"
.IX Header "FUTURE DIRECTIONS"
None.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fI<pthread.h\fR>.
.SH "_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_"
.IX Header "______________________________________________________________________"
.SH "NAME"
\&\fBpthread_attr_setinheritsched,\fR \fBpthread_attr_getinheritsched\fR
\&\- set and get inheritsched attribute
(\fB\s-1REALTIME\s0 \s-1THREADS\s0\fR)
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
#include <pthread.h>
.PP
int pthread_attr_setinheritsched(pthread_attr_t *\fIattr\fR,
int \fIinheritsched\fR);
int pthread_attr_getinheritsched(const pthread_attr_t *\fIattr\fR,
int *\fIinheritsched\fR);
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
The functions \fI\fIpthread_attr_setinheritsched()\fI\fR and
\&\fI\fIpthread_attr_getinheritsched()\fI\fR, respectively, set and get the
\&\fIinheritsched\fR attribute in the \fIattr\fR argument.
.PP
When the attribute objects are used by \fI\fIpthread_create()\fI\fR, the
\&\fIinheritsched\fR attribute determines how the other scheduling attributes
of the created thread are to be set:
.IP "\s-1PTHREAD_INHERIT_SCHED\s0" 4
.IX Item "PTHREAD_INHERIT_SCHED"
Specifies that the scheduling policy and associated attributes are to
be inherited from the creating thread, and the scheduling attributes in
this \fIattr\fR argument are to be ignored.
.IP "\s-1PTHREAD_EXPLICIT_SCHED\s0" 4
.IX Item "PTHREAD_EXPLICIT_SCHED"
Specifies that the scheduling policy and associated attributes
are to be set to the corresponding values from this attribute object.
.PP
The symbols \s-1PTHREAD_INHERIT_SCHED\s0 and \s-1PTHREAD_EXPLICIT_SCHED\s0 are defined
in the header \fI<pthread.h\fR>.
.SH "RETURN VALUE"
.IX Header "RETURN VALUE"
If successful, the \fI\fIpthread_attr_setinheritsched()\fI\fR and
\&\fI\fIpthread_attr_getinheritsched()\fI\fR functions return zero. Otherwise, an
error number is returned to indicate the error.
.SH "ERRORS"
.IX Header "ERRORS"
The \fI\fIpthread_attr_setinheritsched()\fI\fR and
\&\fI\fIpthread_attr_getinheritsched()\fI\fR functions will fail if:
.IP "[\s-1ENOSYS\s0]" 4
.IX Item "[ENOSYS]"
The option _POSIX_THREAD_PRIORITY_SCHEDULING is not defined and the
implementation does not support the function.
.PP
The \fI\fIpthread_attr_setinheritsched()\fI\fR function may fail if:
.IP "[\s-1EINVAL\s0]" 4
.IX Item "[EINVAL]"
The value of the attribute being set is not valid.
.IP "[\s-1ENOTSUP\s0]" 4
.IX Item "[ENOTSUP]"
An attempt was made to set the attribute to an unsupported value.
.SH "EXAMPLES"
.IX Header "EXAMPLES"
None.
.SH "APPLICATION USAGE"
.IX Header "APPLICATION USAGE"
After these attributes have been set, a thread can be created with the
specified attributes using \fI\fIpthread_create()\fI\fR. Using these routines
does not affect the current running thread.
.SH "FUTURE DIRECTIONS"
.IX Header "FUTURE DIRECTIONS"
None.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fI\fIpthread_attr_init()\fI\fR,
\&\fI\fIpthread_attr_setscope()\fI\fR,
\&\fI\fIpthread_attr_setschedpolicy()\fI\fR,
\&\fI\fIpthread_attr_setschedparam()\fI\fR,
\&\fI\fIpthread_create()\fI\fR,
\&\fI<pthread.h\fR>,
\&\fI\fIpthread_setschedparam()\fI\fR,
\&\fI<sched.h\fR>.
.SH "_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_"
.IX Header "______________________________________________________________________"
.SH "NAME"
\&\fBpthread_attr_setschedparam,\fR \fBpthread_attr_getschedparam\fR
\&\- set and get schedparam attribute
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
#include <pthread.h>
.PP
int pthread_attr_setschedparam(pthread_attr_t *\fIattr\fR, const struct sched_param *\fIparam\fR);
.PP
int pthread_attr_getschedparam(const pthread_attr_t *\fIattr\fR, struct sched_param *\fIparam\fR);
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
The functions \fI\fIpthread_attr_setschedparam()\fI\fR and
\&\fI\fIpthread_attr_getschedparam()\fI\fR, respectively, set and get the
scheduling parameter attributes in the \fIattr\fR argument. The contents of
the \fIparam\fR structure are defined in \fI<sched.h\fR>. For the \s-1SCHED_FIFO\s0
and \s-1SCHED_RR\s0 policies, the only required member of \fIparam\fR is
\&\fIsched_priority\fR.
.SH "RETURN VALUE"
.IX Header "RETURN VALUE"
If successful, the \fI\fIpthread_attr_setschedparam()\fI\fR and
\&\fI\fIpthread_attr_getschedparam()\fI\fR functions return zero. Otherwise, an
error number is returned to indicate the error.
.SH "ERRORS"
.IX Header "ERRORS"
The \fI\fIpthread_attr_setschedparam()\fI\fR function may fail if:
.IP "[\s-1EINVAL\s0]" 4
.IX Item "[EINVAL]"
The value of the attribute being set is not valid.
.IP "[\s-1ENOTSUP\s0]" 4
.IX Item "[ENOTSUP]"
An attempt was made to set the attribute to an unsupported value.
.PP
The
\&\fI\fIpthread_attr_setschedparam()\fI\fR
and
\&\fI\fIpthread_attr_getschedparam()\fI\fR
functions will not return an error code of [\s-1EINTR\s0].
.SH "EXAMPLES"
.IX Header "EXAMPLES"
None.
.SH "APPLICATION USAGE"
.IX Header "APPLICATION USAGE"
After these attributes have been set, a thread can be created with the
specified attributes using \fI\fIpthread_create()\fI\fR. Using these routines
does not affect the current running thread.
.SH "FUTURE DIRECTIONS"
.IX Header "FUTURE DIRECTIONS"
None.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fI\fIpthread_attr_init()\fI\fR,
\&\fI\fIpthread_attr_setscope()\fI\fR,
\&\fI\fIpthread_attr_setinheritsched()\fI\fR,
\&\fI\fIpthread_attr_setschedpolicy()\fI\fR,
\&\fI\fIpthread_create()\fI\fR,
\&\fI<pthread.h\fR>,
\&\fI\fIpthread_setschedparam()\fI\fR,
\&\fI<sched.h\fR>.
.SH "_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_"
.IX Header "______________________________________________________________________"
.SH "NAME"
\&\fBpthread_attr_setschedpolicy,\fR \fBpthread_attr_getschedpolicy\fR
\&\- set and get schedpolicy attribute
(\fB\s-1REALTIME\s0 \s-1THREADS\s0\fR)
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
#include <pthread.h>
.PP
int pthread_attr_setschedpolicy(pthread_attr_t *\fIattr\fR, int \fIpolicy\fR);
int pthread_attr_getschedpolicy(const pthread_attr_t *\fIattr\fR,
int *\fIpolicy\fR);
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
The functions \fI\fIpthread_attr_setschedpolicy()\fI\fR and
\&\fI\fIpthread_attr_getschedpolicy()\fI\fR, respectively, set and get the
\&\fIschedpolicy\fR attribute in the \fIattr\fR argument.
.PP
The supported values of \fIpolicy\fR include \s-1SCHED_FIFO\s0, \s-1SCHED_RR\s0 and
\&\s-1SCHED_OTHER\s0, which are defined by the header \fI<sched.h\fR>. When threads
executing with the scheduling policy \s-1SCHED_FIFO\s0 or \s-1SCHED_RR\s0 are waiting
on a mutex, they acquire the mutex in priority order when the mutex is
unlocked.
.SH "RETURN VALUE"
.IX Header "RETURN VALUE"
If successful, the \fI\fIpthread_attr_setschedpolicy()\fI\fR and
\&\fI\fIpthread_attr_getschedpolicy()\fI\fR functions return zero. Otherwise, an
error number is returned to indicate the error.
.SH "ERRORS"
.IX Header "ERRORS"
The \fI\fIpthread_attr_setschedpolicy()\fI\fR and
\&\fI\fIpthread_attr_getschedpolicy()\fI\fR functions will fail if:
.IP "[\s-1ENOSYS\s0]" 4
.IX Item "[ENOSYS]"
The option _POSIX_THREAD_PRIORITY_SCHEDULING is not defined and the
implementation does not support the function.
.PP
The \fI\fIpthread_attr_setschedpolicy()\fI\fR function may fail if:
.IP "[\s-1EINVAL\s0]" 4
.IX Item "[EINVAL]"
The value of the attribute being set is not valid.
.IP "[\s-1ENOTSUP\s0]" 4
.IX Item "[ENOTSUP]"
An attempt was made to set the attribute to an unsupported value.
.SH "EXAMPLES"
.IX Header "EXAMPLES"
None.
.SH "APPLICATION USAGE"
.IX Header "APPLICATION USAGE"
After these attributes have been set, a thread can be created with the
specified attributes using \fI\fIpthread_create()\fI\fR. Using these routines
does not affect the current running thread.
.SH "FUTURE DIRECTIONS"
.IX Header "FUTURE DIRECTIONS"
None.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fI\fIpthread_attr_init()\fI\fR,
\&\fI\fIpthread_attr_setscope()\fI\fR,
\&\fI\fIpthread_attr_setinheritsched()\fI\fR,
\&\fI\fIpthread_attr_setschedparam()\fI\fR,
\&\fI\fIpthread_create()\fI\fR,
\&\fI<pthread.h\fR>,
\&\fI\fIpthread_setschedparam()\fI\fR,
\&\fI<sched.h\fR>.
.SH "_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_"
.IX Header "______________________________________________________________________"
.SH "NAME"
\&\fBpthread_attr_setscope,\fR \fBpthread_attr_getscope\fR
\&\- set and get contentionscope attribute
(\fB\s-1REALTIME\s0 \s-1THREADS\s0\fR)
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
#include <pthread.h>
.PP
int pthread_attr_setscope(pthread_attr_t *\fIattr\fR, int \fIcontentionscope\fR);
int pthread_attr_getscope(const pthread_attr_t *\fIattr\fR,
int *\fIcontentionscope\fR);
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
The \fI\fIpthread_attr_setscope()\fI\fR and \fI\fIpthread_attr_getscope()\fI\fR functions
are used to set and get the \fIcontentionscope\fR attribute in the \fIattr\fR
object.
.PP
The \fIcontentionscope\fR attribute may have the values
\&\s-1PTHREAD_SCOPE_SYSTEM\s0, signifying system scheduling contention scope, or
\&\s-1PTHREAD_SCOPE_PROCESS\s0, signifying process scheduling contention scope.
The symbols \s-1PTHREAD_SCOPE_SYSTEM\s0 and \s-1PTHREAD_SCOPE_PROCESS\s0 are defined
by the header \fI<pthread.h\fR>.
.SH "RETURN VALUE"
.IX Header "RETURN VALUE"
If successful, the \fI\fIpthread_attr_setscope()\fI\fR and
\&\fI\fIpthread_attr_getscope()\fI\fR functions return zero. Otherwise, an error
number is returned to indicate the error.
.SH "ERRORS"
.IX Header "ERRORS"
The \fI\fIpthread_attr_setscope()\fI\fR and \fI\fIpthread_attr_getscope()\fI\fR functions
will fail if:
.IP "[\s-1ENOSYS\s0]" 4
.IX Item "[ENOSYS]"
The option _POSIX_THREAD_PRIORITY_SCHEDULING is not defined and the
implementation does not support the function.
.PP
The
\&\fI\fIpthread_attr_setscope()\fI\fR,
function may fail if:
.IP "[\s-1EINVAL\s0]" 4
.IX Item "[EINVAL]"
The value of the attribute being set is not valid.
.IP "[\s-1ENOTSUP\s0]" 4
.IX Item "[ENOTSUP]"
An attempt was made to set the attribute to an unsupported value.
.SH "EXAMPLES"
.IX Header "EXAMPLES"
None.
.SH "APPLICATION USAGE"
.IX Header "APPLICATION USAGE"
After these attributes have been set, a thread can be created with the
specified attributes using \fI\fIpthread_create()\fI\fR. Using these routines
does not affect the current running thread.
.SH "FUTURE DIRECTIONS"
.IX Header "FUTURE DIRECTIONS"
None.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fI\fIpthread_attr_init()\fI\fR,
\&\fI\fIpthread_attr_setinheritsched()\fI\fR,
\&\fI\fIpthread_attr_setschedpolicy()\fI\fR,
\&\fI\fIpthread_attr_setschedparam()\fI\fR,
\&\fI\fIpthread_create()\fI\fR,
\&\fI<pthread.h\fR>,
\&\fI\fIpthread_setschedparam()\fI\fR,
\&\fI<sched.h\fR>.
.SH "_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_"
.IX Header "______________________________________________________________________"
.SH "NAME"
\&\fBpthread_attr_setstackaddr,\fR \fBpthread_attr_getstackaddr\fR
\&\- set and get stackaddr attribute
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
#include <pthread.h>
.PP
int pthread_attr_setstackaddr(pthread_attr_t *\fIattr\fR, void *\fIstackaddr\fR);
.PP
int pthread_attr_getstackaddr(const pthread_attr_t *\fIattr\fR, void **\fIstackaddr\fR);
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
The functions \fI\fIpthread_attr_setstackaddr()\fI\fR and
\&\fI\fIpthread_attr_getstackaddr()\fI\fR, respectively, set and get the thread
creation \fIstackaddr\fR attribute in the \fIattr\fR object.
.PP
The \fIstackaddr\fR attribute specifies the location of storage to be used
for the created thread's stack. The size of the storage is at least
\&\s-1PTHREAD_STACK_MIN\s0.
.SH "RETURN VALUE"
.IX Header "RETURN VALUE"
Upon successful completion, \fI\fIpthread_attr_setstackaddr()\fI\fR and
\&\fI\fIpthread_attr_getstackaddr()\fI\fR return a value of 0. Otherwise, an error
number is returned to indicate the error.
.PP
The \fI\fIpthread_attr_getstackaddr()\fI\fR function stores the \fIstackaddr\fR
attribute value in \fIstackaddr\fR if successful.
.SH "ERRORS"
.IX Header "ERRORS"
No errors are defined.
.PP
These functions will not return an error code of [\s-1EINTR\s0].
.SH "EXAMPLES"
.IX Header "EXAMPLES"
None.
.SH "APPLICATION USAGE"
.IX Header "APPLICATION USAGE"
None.
.SH "FUTURE DIRECTIONS"
.IX Header "FUTURE DIRECTIONS"
None.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fI\fIpthread_attr_init()\fI\fR,
\&\fI\fIpthread_attr_setdetachstate()\fI\fR,
\&\fI\fIpthread_attr_setstacksize()\fI\fR,
\&\fI\fIpthread_create()\fI\fR,
\&\fI<limits.h\fR>,
\&\fI<pthread.h\fR>.
.SH "_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_\|_"
.IX Header "______________________________________________________________________"
.SH "NAME"
\&\fBpthread_attr_setstacksize,\fR \fBpthread_attr_getstacksize\fR