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