]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/pthread_attr_setschedparam.3
ttyslot.3: tfix
[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.\"
93015253 4.\" %%%LICENSE_START(VERBATIM)
b326494c
MK
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.
8.\"
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.
13.\"
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
20.\" professionally.
21.\"
22.\" Formatted or processed versions of this manual, if unaccompanied by
23.\" the source, must acknowledge the copyright and authors of this work.
4b72fb64 24.\" %%%LICENSE_END
b326494c 25.\"
4b8c67d9 26.TH PTHREAD_ATTR_SETSCHEDPARAM 3 2017-09-15 "Linux" "Linux Programmer's Manual"
b326494c
MK
27.SH NAME
28pthread_attr_setschedparam, pthread_attr_getschedparam \- set/get
29scheduling parameter attributes in thread attributes object
30.SH SYNOPSIS
31.nf
32.B #include <pthread.h>
dbfe9c70 33.PP
b326494c
MK
34.BI "int pthread_attr_setschedparam(pthread_attr_t *" attr ,
35.BI " const struct sched_param *" param );
e59f5f58 36.BI "int pthread_attr_getschedparam(const pthread_attr_t *" attr ,
b326494c 37.BI " struct sched_param *" param );
68e4db0a 38.PP
b326494c 39Compile and link with \fI\-pthread\fP.
6030f2d8 40.fi
b326494c
MK
41.SH DESCRIPTION
42The
43.BR pthread_attr_setschedparam ()
44function sets the scheduling parameter attributes of the
45thread attributes object referred to by
3ab624b6 46.IR attr
b326494c
MK
47to the values specified in the buffer pointed to by
48.IR param .
49These attributes determine the scheduling parameters of
50a thread created using the thread attributes object
51.IR attr .
847e0d88 52.PP
b326494c
MK
53The
54.BR pthread_attr_getschedparam ()
55returns the scheduling parameter attributes of the thread attributes object
56.IR attr
57in the buffer pointed to by
58.IR param .
847e0d88 59.PP
b326494c 60Scheduling parameters are maintained in the following structure:
847e0d88 61.PP
b326494c 62.in +4n
b8302363 63.EX
b326494c
MK
64struct sched_param {
65 int sched_priority; /* Scheduling priority */
66};
b8302363 67.EE
b326494c 68.in
847e0d88 69.PP
4c5f5413 70As can be seen, only one scheduling parameter is supported.
b326494c
MK
71For details of the permitted ranges for scheduling priorities
72in each scheduling policy, see
25ac8173 73.BR sched (7).
847e0d88 74.PP
ea22c6e9
MK
75In order for the parameter setting made by
76.BR pthread_attr_setschedparam ()
77to have effect when calling
78.BR pthread_create (3),
79the caller must use
80.BR pthread_attr_setinheritsched (3)
81to set the inherit-scheduler attribute of the attributes object
82.I attr
83to
84.BR PTHREAD_EXPLICIT_SCHED .
b326494c
MK
85.SH RETURN VALUE
86On success, these functions return 0;
c7094399 87on error, they return a nonzero error number.
b326494c 88.SH ERRORS
3f6dadab
TH
89.BR pthread_attr_setschedparam ()
90can fail with the following error:
91.TP
b326494c 92.B EINVAL
ca126346 93The priority specified in
3f6dadab
TH
94.I param
95does not make sense for the current scheduling policy of
96.IR attr .
97.PP
98POSIX.1 also documents an
b326494c 99.B ENOTSUP
3f6dadab 100error for
b326494c 101.BR pthread_attr_setschedparam ().
3f6dadab 102This value is never returned on Linux
b326494c 103(but portable and future-proof applications should nevertheless
3f6dadab 104handle this error return value).
b326494c
MK
105.\" .SH VERSIONS
106.\" Available since glibc 2.0.
6fea3867 107.SH ATTRIBUTES
0d44d421
PH
108For an explanation of the terms used in this section, see
109.BR attributes (7).
110.TS
111allbox;
112lbw29 lb lb
113l l l.
114Interface Attribute Value
115T{
116.BR pthread_attr_setschedparam (),
6fea3867 117.BR pthread_attr_getschedparam ()
0d44d421
PH
118T} Thread safety MT-Safe
119.TE
b326494c 120.SH CONFORMING TO
06069004 121POSIX.1-2001, POSIX.1-2008.
b326494c
MK
122.SH NOTES
123See
124.BR pthread_attr_setschedpolicy (3)
125for a list of the thread scheduling policies supported on Linux.
22cb459d
MK
126.SH EXAMPLE
127See
128.BR pthread_setschedparam (3).
b326494c 129.SH SEE ALSO
ca8a0bd2
MK
130.ad l
131.nh
b326494c 132.BR sched_get_priority_min (2),
b326494c
MK
133.BR pthread_attr_init (3),
134.BR pthread_attr_setinheritsched (3),
135.BR pthread_attr_setschedpolicy (3),
136.BR pthread_create (3),
137.BR pthread_setschedparam (3),
138.BR pthread_setschedprio (3),
298f72af 139.BR pthreads (7),
25ac8173 140.BR sched (7)