Debian Codegraph @

upstream/debian-unstable/man3/pthread_setschedprio.3

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