1 .\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk
2 .\" <mtk.manpages@gmail.com>
4 .\" %%%LICENSE_START(VERBATIM)
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.
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.
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
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
26 .TH PTHREAD_ATTR_SETSCHEDPARAM 3 2021-03-22 "Linux" "Linux Programmer's Manual"
28 pthread_attr_setschedparam, pthread_attr_getschedparam \- set/get
29 scheduling parameter attributes in thread attributes object
32 .B #include <pthread.h>
34 .BI "int pthread_attr_setschedparam(pthread_attr_t *restrict " attr ,
35 .BI " const struct sched_param *restrict " param );
36 .BI "int pthread_attr_getschedparam(const pthread_attr_t *restrict " attr ,
37 .BI " struct sched_param *restrict " param );
39 Compile and link with \fI\-pthread\fP.
43 .BR pthread_attr_setschedparam ()
44 function sets the scheduling parameter attributes of the
45 thread attributes object referred to by
47 to the values specified in the buffer pointed to by
49 These attributes determine the scheduling parameters of
50 a thread created using the thread attributes object
54 .BR pthread_attr_getschedparam ()
55 returns the scheduling parameter attributes of the thread attributes object
57 in the buffer pointed to by
60 Scheduling parameters are maintained in the following structure:
65 int sched_priority; /* Scheduling priority */
70 As can be seen, only one scheduling parameter is supported.
71 For details of the permitted ranges for scheduling priorities
72 in each scheduling policy, see
75 In order for the parameter setting made by
76 .BR pthread_attr_setschedparam ()
77 to have effect when calling
78 .BR pthread_create (3),
80 .BR pthread_attr_setinheritsched (3)
81 to set the inherit-scheduler attribute of the attributes object
84 .BR PTHREAD_EXPLICIT_SCHED .
86 On success, these functions return 0;
87 on error, they return a nonzero error number.
89 .BR pthread_attr_setschedparam ()
90 can fail with the following error:
93 The priority specified in
95 does not make sense for the current scheduling policy of
98 POSIX.1 also documents an
101 .BR pthread_attr_setschedparam ().
102 This value is never returned on Linux
103 (but portable and future-proof applications should nevertheless
104 handle this error return value).
106 .\" Available since glibc 2.0.
108 For an explanation of the terms used in this section, see
116 Interface Attribute Value
118 .BR pthread_attr_setschedparam (),
119 .BR pthread_attr_getschedparam ()
120 T} Thread safety MT-Safe
126 POSIX.1-2001, POSIX.1-2008.
129 .BR pthread_attr_setschedpolicy (3)
130 for a list of the thread scheduling policies supported on Linux.
133 .BR pthread_setschedparam (3).
137 .BR sched_get_priority_min (2),
138 .BR pthread_attr_init (3),
139 .BR pthread_attr_setinheritsched (3),
140 .BR pthread_attr_setschedpolicy (3),
141 .BR pthread_create (3),
142 .BR pthread_setschedparam (3),
143 .BR pthread_setschedprio (3),