]>
Commit | Line | Data |
---|---|---|
b6a82811 MK |
1 | .\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk |
2 | .\" <mtk.manpages@gmail.com> | |
3 | .\" | |
93015253 | 4 | .\" %%%LICENSE_START(VERBATIM) |
b6a82811 MK |
5 | .\" Permission is granted to make and distribute verbatim copies of this |
6 | .\" manual provided the copyright notice and this permission notice are | |
7 | .\" preserved on all copies. | |
8 | .\" | |
9 | .\" Permission is granted to copy and distribute modified versions of this | |
10 | .\" manual under the conditions for verbatim copying, provided that the | |
11 | .\" entire resulting derived work is distributed under the terms of a | |
12 | .\" permission notice identical to this one. | |
13 | .\" | |
14 | .\" Since the Linux kernel and libraries are constantly changing, this | |
15 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
16 | .\" responsibility for errors or omissions, or for damages resulting from | |
17 | .\" the use of the information contained herein. The author(s) may not | |
18 | .\" have taken the same level of care in the production of this manual, | |
19 | .\" which is licensed free of charge, as they might when working | |
20 | .\" professionally. | |
21 | .\" | |
22 | .\" Formatted or processed versions of this manual, if unaccompanied by | |
23 | .\" the source, must acknowledge the copyright and authors of this work. | |
4b72fb64 | 24 | .\" %%%LICENSE_END |
b6a82811 | 25 | .\" |
4b8c67d9 | 26 | .TH PTHREAD_ATTR_SETINHERITSCHED 3 2017-09-15 "Linux" "Linux Programmer's Manual" |
b6a82811 MK |
27 | .SH NAME |
28 | pthread_attr_setinheritsched, pthread_attr_getinheritsched \- set/get | |
b67b5886 | 29 | inherit-scheduler attribute in thread attributes object |
b6a82811 MK |
30 | .SH SYNOPSIS |
31 | .nf | |
32 | .B #include <pthread.h> | |
dbfe9c70 | 33 | .PP |
b6a82811 MK |
34 | .BI "int pthread_attr_setinheritsched(pthread_attr_t *" attr , |
35 | .BI " int " inheritsched ); | |
e59f5f58 | 36 | .BI "int pthread_attr_getinheritsched(const pthread_attr_t *" attr , |
b6a82811 | 37 | .BI " int *" inheritsched ); |
68e4db0a | 38 | .PP |
b6a82811 | 39 | Compile and link with \fI\-pthread\fP. |
6030f2d8 | 40 | .fi |
b6a82811 MK |
41 | .SH DESCRIPTION |
42 | The | |
43 | .BR pthread_attr_setinheritsched () | |
b67b5886 | 44 | function sets the inherit-scheduler attribute of the |
b6a82811 | 45 | thread attributes object referred to by |
5b99d426 | 46 | .IR attr |
b6a82811 MK |
47 | to the value specified in |
48 | .IR inheritsched . | |
b67b5886 | 49 | The inherit-scheduler attribute determines whether a thread created using |
b6a82811 MK |
50 | the thread attributes object |
51 | .I attr | |
52 | will inherit its scheduling attributes from the calling thread | |
53 | or whether it will take them from | |
54 | .IR attr . | |
847e0d88 | 55 | .PP |
c59c89b3 MK |
56 | The following scheduling attributes are affected by the |
57 | inherit-scheduler attribute: | |
58 | scheduling policy | |
59 | .RB ( pthread_attr_setschedpolicy (3)), | |
60 | scheduling priority | |
61 | .RB ( pthread_attr_setschedparam (3)), | |
62 | and contention scope | |
63 | .RB ( pthread_attr_setscope (3)). | |
847e0d88 | 64 | .PP |
b6a82811 MK |
65 | The following values may be specified in |
66 | .IR inheritsched : | |
67 | .TP | |
68 | .B PTHREAD_INHERIT_SCHED | |
69 | Threads that are created using | |
70 | .I attr | |
71 | inherit scheduling attributes from the creating thread; | |
72 | the scheduling attributes in | |
73 | .I attr | |
74 | are ignored. | |
75 | .TP | |
76 | .B PTHREAD_EXPLICIT_SCHED | |
77 | Threads that are created using | |
78 | .I attr | |
79 | take their scheduling attributes from the values specified | |
80 | by the attributes object. | |
bea08fec | 81 | .\" FIXME Document the defaults for scheduler settings |
b6a82811 | 82 | .PP |
b67b5886 | 83 | The default setting of the inherit-scheduler attribute in |
b6a82811 MK |
84 | a newly initialized thread attributes object is |
85 | .BR PTHREAD_INHERIT_SCHED . | |
847e0d88 | 86 | .PP |
b6a82811 MK |
87 | The |
88 | .BR pthread_attr_getinheritsched () | |
b67b5886 | 89 | returns the inherit-scheduler attribute of the thread attributes object |
b6a82811 MK |
90 | .IR attr |
91 | in the buffer pointed to by | |
92 | .IR inheritsched . | |
93 | .SH RETURN VALUE | |
94 | On success, these functions return 0; | |
c7094399 | 95 | on error, they return a nonzero error number. |
b6a82811 MK |
96 | .SH ERRORS |
97 | .BR pthread_attr_setinheritsched () | |
98 | can fail with the following error: | |
99 | .TP | |
100 | .B EINVAL | |
101 | Invalid value in | |
102 | .IR inheritsched . | |
103 | .PP | |
e29779d9 | 104 | POSIX.1 also documents an optional |
b6a82811 MK |
105 | .B ENOTSUP |
106 | error ("attempt was made to set the attribute to an unsupported value") for | |
107 | .BR pthread_attr_setinheritsched (). | |
108 | .\" .SH VERSIONS | |
109 | .\" Available since glibc 2.0. | |
47fb8a7f | 110 | .SH ATTRIBUTES |
e4d2f415 PH |
111 | For an explanation of the terms used in this section, see |
112 | .BR attributes (7). | |
113 | .TS | |
114 | allbox; | |
115 | lbw31 lb lb | |
116 | l l l. | |
117 | Interface Attribute Value | |
118 | T{ | |
119 | .BR pthread_attr_setinheritsched (), | |
47fb8a7f | 120 | .BR pthread_attr_getinheritsched () |
e4d2f415 PH |
121 | T} Thread safety MT-Safe |
122 | .TE | |
b6a82811 | 123 | .SH CONFORMING TO |
e29779d9 | 124 | POSIX.1-2001, POSIX.1-2008. |
b6a82811 MK |
125 | .SH BUGS |
126 | As at glibc 2.8, if a thread attributes object is initialized using | |
127 | .BR pthread_attr_init (3), | |
128 | then the scheduling policy of the attributes object is set to | |
129 | .BR SCHED_OTHER | |
130 | and the scheduling priority is set to 0. | |
b67b5886 | 131 | However, if the inherit-scheduler attribute is then set to |
b6a82811 MK |
132 | .BR PTHREAD_EXPLICIT_SCHED , |
133 | then a thread created using the attribute object | |
134 | wrongly inherits its scheduling attributes from the creating thread. | |
135 | This bug does not occur if either the scheduling policy or | |
136 | scheduling priority attribute is explicitly set | |
137 | in the thread attributes object before calling | |
138 | .BR pthread_create (3). | |
139 | .\" FIXME . Track status of the following bug: | |
140 | .\" http://sourceware.org/bugzilla/show_bug.cgi?id=7007 | |
22cb459d MK |
141 | .SH EXAMPLE |
142 | See | |
143 | .BR pthread_setschedparam (3). | |
b6a82811 | 144 | .SH SEE ALSO |
ca8a0bd2 MK |
145 | .ad l |
146 | .nh | |
b6a82811 MK |
147 | .BR pthread_attr_init (3), |
148 | .BR pthread_attr_setschedparam (3), | |
149 | .BR pthread_attr_setschedpolicy (3), | |
c59c89b3 | 150 | .BR pthread_attr_setscope (3), |
b6a82811 MK |
151 | .BR pthread_create (3), |
152 | .BR pthread_setschedparam (3), | |
153 | .BR pthread_setschedprio (3), | |
3e2cae49 | 154 | .BR pthreads (7), |
25ac8173 | 155 | .BR sched (7) |