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