]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/pthread_setschedprio.3
err.3: EXAMPLES: use EXIT_FAILURE rather than 1 as exit status
[thirdparty/man-pages.git] / man3 / pthread_setschedprio.3
CommitLineData
4888dfbf
MK
1.\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk
2.\" <mtk.manpages@gmail.com>
3.\"
93015253 4.\" %%%LICENSE_START(VERBATIM)
4888dfbf
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
4888dfbf 25.\"
460495ca 26.TH PTHREAD_SETSCHEDPRIO 3 2015-08-08 "Linux" "Linux Programmer's Manual"
4888dfbf
MK
27.SH NAME
28pthread_setschedprio \- set scheduling priority of a thread
29.SH SYNOPSIS
30.nf
31.B #include <pthread.h>
dbfe9c70 32.PP
1ac20a9e 33.BI "int pthread_setschedprio(pthread_t " thread ", int " prio );
68e4db0a 34.PP
4888dfbf 35Compile and link with \fI\-pthread\fP.
6030f2d8 36.fi
4888dfbf
MK
37.SH DESCRIPTION
38The
39.BR pthread_setschedprio ()
40function sets the scheduling priority of the thread
41.I thread
42to the value specified in
43.IR prio .
44(By contrast
45.BR pthread_setschedparam (3)
46changes both the scheduling policy and priority of a thread.)
47.\" FIXME . nptl/pthread_setschedprio.c has the following
48.\" /* If the thread should have higher priority because of some
49.\" PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */
50.\" Eventually (perhaps after writing the mutexattr pages), we
51.\" may want to add something on the topic to this page.
52.\" nptl/pthread_setschedparam.c has a similar case.
53.SH RETURN VALUE
54On success, this function returns 0;
c7094399 55on error, it returns a nonzero error number.
4888dfbf
MK
56If
57.BR pthread_setschedprio ()
58fails, the scheduling priority of
59.I thread
60is not changed.
61.SH ERRORS
62.TP
63.B EINVAL
64.I prio
65is not valid for the scheduling policy of the specified thread.
66.TP
67.B EPERM
68The caller does not have appropriate privileges
69to set the specified priority.
70.TP
71.B ESRCH
72No thread with the ID
73.I thread
74could be found.
75.PP
20b7991d 76POSIX.1 also documents an
4888dfbf
MK
77.B ENOTSUP
78("attempt was made to set the priority
79to an unsupported value") error for
0b80cf56 80.BR pthread_setschedparam (3).
4888dfbf
MK
81.SH VERSIONS
82This function is available in glibc since version 2.3.4.
49a933b0 83.SH ATTRIBUTES
f158af49
PH
84For an explanation of the terms used in this section, see
85.BR attributes (7).
86.TS
87allbox;
88lbw22 lb lb
89l l l.
90Interface Attribute Value
91T{
49a933b0 92.BR pthread_setschedprio ()
f158af49
PH
93T} Thread safety MT-Safe
94.TE
4888dfbf 95.SH CONFORMING TO
20b7991d 96POSIX.1-2001, POSIX.1-2008.
4888dfbf
MK
97.SH NOTES
98For a description of the permissions required to, and the effect of,
99changing a thread's scheduling priority,
100and details of the permitted ranges for priorities
101in each scheduling policy, see
25ac8173 102.BR sched (7).
4888dfbf 103.SH SEE ALSO
ca8a0bd2
MK
104.ad l
105.nh
4888dfbf
MK
106.BR getrlimit (2),
107.BR sched_get_priority_min (2),
4888dfbf
MK
108.BR pthread_attr_init (3),
109.BR pthread_attr_setinheritsched (3),
110.BR pthread_attr_setschedparam (3),
111.BR pthread_attr_setschedpolicy (3),
4888dfbf
MK
112.BR pthread_create (3),
113.BR pthread_self (3),
3e5c319e 114.BR pthread_setschedparam (3),
25ac8173
MK
115.BR pthreads (7),
116.BR sched (7)