]>
Commit | Line | Data |
---|---|---|
2f80dc37 MK |
1 | .\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk |
2 | .\" <mtk.manpages@gmail.com> | |
3 | .\" | |
93015253 | 4 | .\" %%%LICENSE_START(VERBATIM) |
2f80dc37 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 |
2f80dc37 | 25 | .\" |
4b8c67d9 | 26 | .TH PTHREAD_ATTR_SETSCHEDPOLICY 3 2017-09-15 "Linux" "Linux Programmer's Manual" |
2f80dc37 MK |
27 | .SH NAME |
28 | pthread_attr_setschedpolicy, pthread_attr_getschedpolicy \- set/get | |
29 | scheduling policy attribute in thread attributes object | |
30 | .SH SYNOPSIS | |
31 | .nf | |
32 | .B #include <pthread.h> | |
dbfe9c70 | 33 | .PP |
dc05a5d5 MK |
34 | .BI "int pthread_attr_setschedpolicy(pthread_attr_t *" attr \ |
35 | ", int " policy ); | |
e59f5f58 | 36 | .BI "int pthread_attr_getschedpolicy(const pthread_attr_t *" attr \ |
4c3586b3 | 37 | ", int " *policy ); |
68e4db0a | 38 | .PP |
2f80dc37 | 39 | Compile and link with \fI\-pthread\fP. |
6030f2d8 | 40 | .fi |
2f80dc37 MK |
41 | .SH DESCRIPTION |
42 | The | |
43 | .BR pthread_attr_setschedpolicy () | |
44 | function sets the scheduling policy attribute of the | |
45 | thread attributes object referred to by | |
3ab624b6 | 46 | .IR attr |
2f80dc37 MK |
47 | to the value specified in |
48 | .IR policy . | |
49 | This attribute determines the scheduling policy of | |
50 | a thread created using the thread attributes object | |
51 | .IR attr . | |
847e0d88 | 52 | .PP |
2f80dc37 MK |
53 | The supported values for |
54 | .I policy | |
55 | are | |
56 | .BR SCHED_FIFO , | |
57 | .BR SCHED_RR , | |
58 | and | |
59 | .BR SCHED_OTHER , | |
60 | with the semantics described in | |
25ac8173 | 61 | .BR sched (7). |
f1e29e27 MK |
62 | .\" FIXME . pthread_setschedparam() places no restriction on the policy, |
63 | .\" but pthread_attr_setschedpolicy() restricts policy to RR/FIFO/OTHER | |
64 | .\" http://sourceware.org/bugzilla/show_bug.cgi?id=7013 | |
847e0d88 | 65 | .PP |
2f80dc37 MK |
66 | The |
67 | .BR pthread_attr_getschedpolicy () | |
68 | returns the scheduling policy attribute of the thread attributes object | |
69 | .IR attr | |
70 | in the buffer pointed to by | |
71 | .IR policy . | |
847e0d88 | 72 | .PP |
ea22c6e9 MK |
73 | In order for the policy setting made by |
74 | .BR pthread_attr_setschedpolicy () | |
75 | to have effect when calling | |
76 | .BR pthread_create (3), | |
77 | the caller must use | |
78 | .BR pthread_attr_setinheritsched (3) | |
79 | to set the inherit-scheduler attribute of the attributes object | |
80 | .I attr | |
81 | to | |
82 | .BR PTHREAD_EXPLICIT_SCHED . | |
2f80dc37 MK |
83 | .SH RETURN VALUE |
84 | On success, these functions return 0; | |
c7094399 | 85 | on error, they return a nonzero error number. |
2f80dc37 MK |
86 | .SH ERRORS |
87 | .BR pthread_attr_setschedpolicy () | |
88 | can fail with the following error: | |
89 | .TP | |
90 | .B EINVAL | |
91 | Invalid value in | |
92 | .IR policy . | |
93 | .PP | |
4ebb1248 | 94 | POSIX.1 also documents an optional |
2f80dc37 MK |
95 | .B ENOTSUP |
96 | error ("attempt was made to set the attribute to an unsupported value") for | |
97 | .BR pthread_attr_setschedpolicy (). | |
98 | .\" .SH VERSIONS | |
99 | .\" Available since glibc 2.0. | |
1cfb2946 | 100 | .SH ATTRIBUTES |
b86e7983 PH |
101 | For an explanation of the terms used in this section, see |
102 | .BR attributes (7). | |
103 | .TS | |
104 | allbox; | |
105 | lbw30 lb lb | |
106 | l l l. | |
107 | Interface Attribute Value | |
108 | T{ | |
109 | .BR pthread_attr_setschedpolicy (), | |
1cfb2946 | 110 | .BR pthread_attr_getschedpolicy () |
b86e7983 PH |
111 | T} Thread safety MT-Safe |
112 | .TE | |
2f80dc37 | 113 | .SH CONFORMING TO |
4ebb1248 | 114 | POSIX.1-2001, POSIX.1-2008. |
1f627224 MK |
115 | .SH EXAMPLE |
116 | See | |
117 | .BR pthread_setschedparam (3). | |
2f80dc37 | 118 | .SH SEE ALSO |
ca8a0bd2 MK |
119 | .ad l |
120 | .nh | |
2f80dc37 MK |
121 | .BR pthread_attr_init (3), |
122 | .BR pthread_attr_setinheritsched (3), | |
123 | .BR pthread_attr_setschedparam (3), | |
124 | .BR pthread_create (3), | |
125 | .BR pthread_setschedparam (3), | |
126 | .BR pthread_setschedprio (3), | |
25ac8173 MK |
127 | .BR pthreads (7), |
128 | .BR sched (7) |