]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/pthread_setschedprio.3
caa61682555ab10eaf10d00c0327fd9ee0dd13d7
[thirdparty/man-pages.git] / man3 / pthread_setschedprio.3
1 '\" t
2 .\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk
3 .\" <mtk.manpages@gmail.com>
4 .\"
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\"
7 .TH pthread_setschedprio 3 (date) "Linux man-pages (unreleased)"
8 .SH NAME
9 pthread_setschedprio \- set scheduling priority of a thread
10 .SH LIBRARY
11 POSIX threads library
12 .RI ( libpthread ", " \-lpthread )
13 .SH SYNOPSIS
14 .nf
15 .B #include <pthread.h>
16 .PP
17 .BI "int pthread_setschedprio(pthread_t " thread ", int " prio );
18 .fi
19 .SH DESCRIPTION
20 The
21 .BR pthread_setschedprio ()
22 function sets the scheduling priority of the thread
23 .I thread
24 to the value specified in
25 .IR prio .
26 (By contrast
27 .BR pthread_setschedparam (3)
28 changes both the scheduling policy and priority of a thread.)
29 .\" FIXME . nptl/pthread_setschedprio.c has the following
30 .\" /* If the thread should have higher priority because of some
31 .\" PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */
32 .\" Eventually (perhaps after writing the mutexattr pages), we
33 .\" may want to add something on the topic to this page.
34 .\" nptl/pthread_setschedparam.c has a similar case.
35 .SH RETURN VALUE
36 On success, this function returns 0;
37 on error, it returns a nonzero error number.
38 If
39 .BR pthread_setschedprio ()
40 fails, the scheduling priority of
41 .I thread
42 is not changed.
43 .SH ERRORS
44 .TP
45 .B EINVAL
46 .I prio
47 is not valid for the scheduling policy of the specified thread.
48 .TP
49 .B EPERM
50 The caller does not have appropriate privileges
51 to set the specified priority.
52 .TP
53 .B ESRCH
54 No thread with the ID
55 .I thread
56 could be found.
57 .PP
58 POSIX.1 also documents an
59 .B ENOTSUP
60 ("attempt was made to set the priority
61 to an unsupported value") error for
62 .BR pthread_setschedparam (3).
63 .SH ATTRIBUTES
64 For an explanation of the terms used in this section, see
65 .BR attributes (7).
66 .ad l
67 .nh
68 .TS
69 allbox;
70 lbx lb lb
71 l l l.
72 Interface Attribute Value
73 T{
74 .BR pthread_setschedprio ()
75 T} Thread safety MT-Safe
76 .TE
77 .hy
78 .ad
79 .sp 1
80 .SH STANDARDS
81 POSIX.1-2008.
82 .SH HISTORY
83 glibc 2.3.4.
84 POSIX.1-2001.
85 .SH NOTES
86 For a description of the permissions required to, and the effect of,
87 changing a thread's scheduling priority,
88 and details of the permitted ranges for priorities
89 in each scheduling policy, see
90 .BR sched (7).
91 .SH SEE ALSO
92 .ad l
93 .nh
94 .BR getrlimit (2),
95 .BR sched_get_priority_min (2),
96 .BR pthread_attr_init (3),
97 .BR pthread_attr_setinheritsched (3),
98 .BR pthread_attr_setschedparam (3),
99 .BR pthread_attr_setschedpolicy (3),
100 .BR pthread_create (3),
101 .BR pthread_self (3),
102 .BR pthread_setschedparam (3),
103 .BR pthreads (7),
104 .BR sched (7)