]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/pthread_attr_setschedparam.3
Many pages: Fix style issues reported by `make lint-groff`
[thirdparty/man-pages.git] / man3 / pthread_attr_setschedparam.3
CommitLineData
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
8pthread_attr_setschedparam, pthread_attr_getschedparam \- set/get
9scheduling parameter attributes in thread attributes object
57cf70b5
AC
10.SH LIBRARY
11POSIX 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
23The
24.BR pthread_attr_setschedparam ()
25function sets the scheduling parameter attributes of the
26thread attributes object referred to by
1ae6b2c7 27.I attr
b326494c
MK
28to the values specified in the buffer pointed to by
29.IR param .
30These attributes determine the scheduling parameters of
31a thread created using the thread attributes object
32.IR attr .
847e0d88 33.PP
b326494c
MK
34The
35.BR pthread_attr_getschedparam ()
36returns the scheduling parameter attributes of the thread attributes object
1ae6b2c7 37.I attr
b326494c
MK
38in the buffer pointed to by
39.IR param .
847e0d88 40.PP
b326494c 41Scheduling parameters are maintained in the following structure:
847e0d88 42.PP
b326494c 43.in +4n
b8302363 44.EX
b326494c
MK
45struct sched_param {
46 int sched_priority; /* Scheduling priority */
47};
b8302363 48.EE
b326494c 49.in
847e0d88 50.PP
4c5f5413 51As can be seen, only one scheduling parameter is supported.
b326494c
MK
52For details of the permitted ranges for scheduling priorities
53in each scheduling policy, see
25ac8173 54.BR sched (7).
847e0d88 55.PP
ea22c6e9
MK
56In order for the parameter setting made by
57.BR pthread_attr_setschedparam ()
58to have effect when calling
59.BR pthread_create (3),
60the caller must use
61.BR pthread_attr_setinheritsched (3)
62to set the inherit-scheduler attribute of the attributes object
63.I attr
64to
65.BR PTHREAD_EXPLICIT_SCHED .
b326494c
MK
66.SH RETURN VALUE
67On success, these functions return 0;
c7094399 68on error, they return a nonzero error number.
b326494c 69.SH ERRORS
3f6dadab
TH
70.BR pthread_attr_setschedparam ()
71can fail with the following error:
72.TP
b326494c 73.B EINVAL
ca126346 74The priority specified in
3f6dadab
TH
75.I param
76does not make sense for the current scheduling policy of
77.IR attr .
78.PP
79POSIX.1 also documents an
b326494c 80.B ENOTSUP
3f6dadab 81error for
b326494c 82.BR pthread_attr_setschedparam ().
3f6dadab 83This value is never returned on Linux
b326494c 84(but portable and future-proof applications should nevertheless
3f6dadab 85handle this error return value).
b326494c
MK
86.\" .SH VERSIONS
87.\" Available since glibc 2.0.
6fea3867 88.SH ATTRIBUTES
0d44d421
PH
89For 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
94allbox;
c466875e 95lbx lb lb
0d44d421
PH
96l l l.
97Interface Attribute Value
98T{
99.BR pthread_attr_setschedparam (),
6fea3867 100.BR pthread_attr_getschedparam ()
0d44d421
PH
101T} Thread safety MT-Safe
102.TE
c466875e
MK
103.hy
104.ad
105.sp 1
b326494c 106.SH CONFORMING TO
06069004 107POSIX.1-2001, POSIX.1-2008.
b326494c
MK
108.SH NOTES
109See
110.BR pthread_attr_setschedpolicy (3)
111for a list of the thread scheduling policies supported on Linux.
a14af333 112.SH EXAMPLES
22cb459d
MK
113See
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)