1PTHREAD_SETSCHEDPRIO(3) Linux Programmer's Manual PTHREAD_SETSCHEDPRIO(3)
2
3
4
6 pthread_setschedprio - set scheduling priority of a thread
7
9 #include <pthread.h>
10
11 int pthread_setschedprio(pthread_t thread, int prio);
12
13 Compile and link with -pthread.
14
16 The pthread_setschedprio() function sets the scheduling priority of the
17 thread thread to the value specified in prio. (By contrast
18 pthread_setschedparam(3) changes both the scheduling policy and prior‐
19 ity of a thread.)
20
22 On success, this function returns 0; on error, it returns a nonzero er‐
23 ror number. If pthread_setschedprio() fails, the scheduling priority
24 of thread is not changed.
25
27 EINVAL prio is not valid for the scheduling policy of the specified
28 thread.
29
30 EPERM The caller does not have appropriate privileges to set the spec‐
31 ified priority.
32
33 ESRCH No thread with the ID thread could be found.
34
35 POSIX.1 also documents an ENOTSUP ("attempt was made to set the prior‐
36 ity to an unsupported value") error for pthread_setschedparam(3).
37
39 This function is available in glibc since version 2.3.4.
40
42 For an explanation of the terms used in this section, see at‐
43 tributes(7).
44
45 ┌────────────────────────────────────────────┬───────────────┬─────────┐
46 │Interface │ Attribute │ Value │
47 ├────────────────────────────────────────────┼───────────────┼─────────┤
48 │pthread_setschedprio() │ Thread safety │ MT-Safe │
49 └────────────────────────────────────────────┴───────────────┴─────────┘
50
52 POSIX.1-2001, POSIX.1-2008.
53
55 For a description of the permissions required to, and the effect of,
56 changing a thread's scheduling priority, and details of the permitted
57 ranges for priorities in each scheduling policy, see sched(7).
58
60 getrlimit(2), sched_get_priority_min(2), pthread_attr_init(3),
61 pthread_attr_setinheritsched(3), pthread_attr_setschedparam(3),
62 pthread_attr_setschedpolicy(3), pthread_create(3), pthread_self(3),
63 pthread_setschedparam(3), pthreads(7), sched(7)
64
66 This page is part of release 5.13 of the Linux man-pages project. A
67 description of the project, information about reporting bugs, and the
68 latest version of this page, can be found at
69 https://www.kernel.org/doc/man-pages/.
70
71
72
73Linux 2021-03-22 PTHREAD_SETSCHEDPRIO(3)