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
23 error 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
43 attributes(7).
44
45 ┌───────────────────────┬───────────────┬─────────┐
46 │Interface │ Attribute │ Value │
47 ├───────────────────────┼───────────────┼─────────┤
48 │pthread_setschedprio() │ Thread safety │ MT-Safe │
49 └───────────────────────┴───────────────┴─────────┘
51 POSIX.1-2001, POSIX.1-2008.
52
54 For a description of the permissions required to, and the effect of,
55 changing a thread's scheduling priority, and details of the permitted
56 ranges for priorities in each scheduling policy, see sched(7).
57
59 getrlimit(2), sched_get_priority_min(2), pthread_attr_init(3),
60 pthread_attr_setinheritsched(3), pthread_attr_setschedparam(3),
61 pthread_attr_setschedpolicy(3), pthread_create(3), pthread_self(3),
62 pthread_setschedparam(3), pthreads(7), sched(7)
63
65 This page is part of release 5.02 of the Linux man-pages project. A
66 description of the project, information about reporting bugs, and the
67 latest version of this page, can be found at
68 https://www.kernel.org/doc/man-pages/.
69
70
71
72Linux 2015-08-08 PTHREAD_SETSCHEDPRIO(3)