]>
Commit | Line | Data |
---|---|---|
b326494c MK |
1 | .\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk |
2 | .\" <mtk.manpages@gmail.com> | |
3 | .\" | |
5fbde956 | 4 | .\" SPDX-License-Identifier: Linux-man-pages-copyleft |
b326494c | 5 | .\" |
1d767b55 | 6 | .TH PTHREAD_ATTR_SETSCHEDPARAM 3 2021-03-22 "Linux" "Linux Programmer's Manual" |
b326494c MK |
7 | .SH NAME |
8 | pthread_attr_setschedparam, pthread_attr_getschedparam \- set/get | |
9 | scheduling parameter attributes in thread attributes object | |
57cf70b5 AC |
10 | .SH LIBRARY |
11 | POSIX threads library | |
8fc3b2cf | 12 | .RI ( libpthread ", " \-lpthread ) |
b326494c MK |
13 | .SH SYNOPSIS |
14 | .nf | |
15 | .B #include <pthread.h> | |
dbfe9c70 | 16 | .PP |
5175f162 AC |
17 | .BI "int pthread_attr_setschedparam(pthread_attr_t *restrict " attr , |
18 | .BI " const struct sched_param *restrict " param ); | |
19 | .BI "int pthread_attr_getschedparam(const pthread_attr_t *restrict " attr , | |
20 | .BI " struct sched_param *restrict " param ); | |
6030f2d8 | 21 | .fi |
b326494c MK |
22 | .SH DESCRIPTION |
23 | The | |
24 | .BR pthread_attr_setschedparam () | |
25 | function sets the scheduling parameter attributes of the | |
26 | thread attributes object referred to by | |
1ae6b2c7 | 27 | .I attr |
b326494c MK |
28 | to the values specified in the buffer pointed to by |
29 | .IR param . | |
30 | These attributes determine the scheduling parameters of | |
31 | a thread created using the thread attributes object | |
32 | .IR attr . | |
847e0d88 | 33 | .PP |
b326494c MK |
34 | The |
35 | .BR pthread_attr_getschedparam () | |
36 | returns the scheduling parameter attributes of the thread attributes object | |
1ae6b2c7 | 37 | .I attr |
b326494c MK |
38 | in the buffer pointed to by |
39 | .IR param . | |
847e0d88 | 40 | .PP |
b326494c | 41 | Scheduling parameters are maintained in the following structure: |
847e0d88 | 42 | .PP |
b326494c | 43 | .in +4n |
b8302363 | 44 | .EX |
b326494c MK |
45 | struct sched_param { |
46 | int sched_priority; /* Scheduling priority */ | |
47 | }; | |
b8302363 | 48 | .EE |
b326494c | 49 | .in |
847e0d88 | 50 | .PP |
4c5f5413 | 51 | As can be seen, only one scheduling parameter is supported. |
b326494c MK |
52 | For details of the permitted ranges for scheduling priorities |
53 | in each scheduling policy, see | |
25ac8173 | 54 | .BR sched (7). |
847e0d88 | 55 | .PP |
ea22c6e9 MK |
56 | In order for the parameter setting made by |
57 | .BR pthread_attr_setschedparam () | |
58 | to have effect when calling | |
59 | .BR pthread_create (3), | |
60 | the caller must use | |
61 | .BR pthread_attr_setinheritsched (3) | |
62 | to set the inherit-scheduler attribute of the attributes object | |
63 | .I attr | |
64 | to | |
65 | .BR PTHREAD_EXPLICIT_SCHED . | |
b326494c MK |
66 | .SH RETURN VALUE |
67 | On success, these functions return 0; | |
c7094399 | 68 | on error, they return a nonzero error number. |
b326494c | 69 | .SH ERRORS |
3f6dadab TH |
70 | .BR pthread_attr_setschedparam () |
71 | can fail with the following error: | |
72 | .TP | |
b326494c | 73 | .B EINVAL |
ca126346 | 74 | The priority specified in |
3f6dadab TH |
75 | .I param |
76 | does not make sense for the current scheduling policy of | |
77 | .IR attr . | |
78 | .PP | |
79 | POSIX.1 also documents an | |
b326494c | 80 | .B ENOTSUP |
3f6dadab | 81 | error for |
b326494c | 82 | .BR pthread_attr_setschedparam (). |
3f6dadab | 83 | This value is never returned on Linux |
b326494c | 84 | (but portable and future-proof applications should nevertheless |
3f6dadab | 85 | handle this error return value). |
b326494c MK |
86 | .\" .SH VERSIONS |
87 | .\" Available since glibc 2.0. | |
6fea3867 | 88 | .SH ATTRIBUTES |
0d44d421 PH |
89 | For an explanation of the terms used in this section, see |
90 | .BR attributes (7). | |
c466875e MK |
91 | .ad l |
92 | .nh | |
0d44d421 PH |
93 | .TS |
94 | allbox; | |
c466875e | 95 | lbx lb lb |
0d44d421 PH |
96 | l l l. |
97 | Interface Attribute Value | |
98 | T{ | |
99 | .BR pthread_attr_setschedparam (), | |
6fea3867 | 100 | .BR pthread_attr_getschedparam () |
0d44d421 PH |
101 | T} Thread safety MT-Safe |
102 | .TE | |
c466875e MK |
103 | .hy |
104 | .ad | |
105 | .sp 1 | |
b326494c | 106 | .SH CONFORMING TO |
06069004 | 107 | POSIX.1-2001, POSIX.1-2008. |
b326494c MK |
108 | .SH NOTES |
109 | See | |
110 | .BR pthread_attr_setschedpolicy (3) | |
111 | for a list of the thread scheduling policies supported on Linux. | |
a14af333 | 112 | .SH EXAMPLES |
22cb459d MK |
113 | See |
114 | .BR pthread_setschedparam (3). | |
b326494c | 115 | .SH SEE ALSO |
ca8a0bd2 MK |
116 | .ad l |
117 | .nh | |
b326494c | 118 | .BR sched_get_priority_min (2), |
b326494c MK |
119 | .BR pthread_attr_init (3), |
120 | .BR pthread_attr_setinheritsched (3), | |
121 | .BR pthread_attr_setschedpolicy (3), | |
122 | .BR pthread_create (3), | |
123 | .BR pthread_setschedparam (3), | |
124 | .BR pthread_setschedprio (3), | |
298f72af | 125 | .BR pthreads (7), |
25ac8173 | 126 | .BR sched (7) |