1pthread_setschedprio(3) Library Functions Manual pthread_setschedprio(3)
2
3
4
6 pthread_setschedprio - set scheduling priority of a thread
7
9 POSIX threads library (libpthread, -lpthread)
10
12 #include <pthread.h>
13
14 int pthread_setschedprio(pthread_t thread, int prio);
15
17 The pthread_setschedprio() function sets the scheduling priority of the
18 thread thread to the value specified in prio. (By contrast
19 pthread_setschedparam(3) changes both the scheduling policy and prior‐
20 ity of a thread.)
21
23 On success, this function returns 0; on error, it returns a nonzero er‐
24 ror number. If pthread_setschedprio() fails, the scheduling priority
25 of thread is not changed.
26
28 EINVAL prio is not valid for the scheduling policy of the specified
29 thread.
30
31 EPERM The caller does not have appropriate privileges to set the spec‐
32 ified priority.
33
34 ESRCH No thread with the ID thread could be found.
35
36 POSIX.1 also documents an ENOTSUP ("attempt was made to set the prior‐
37 ity to an unsupported value") error for pthread_setschedparam(3).
38
40 For an explanation of the terms used in this section, see at‐
41 tributes(7).
42
43 ┌────────────────────────────────────────────┬───────────────┬─────────┐
44 │Interface │ Attribute │ Value │
45 ├────────────────────────────────────────────┼───────────────┼─────────┤
46 │pthread_setschedprio() │ Thread safety │ MT-Safe │
47 └────────────────────────────────────────────┴───────────────┴─────────┘
48
50 POSIX.1-2008.
51
53 glibc 2.3.4. POSIX.1-2001.
54
56 For a description of the permissions required to, and the effect of,
57 changing a thread's scheduling priority, and details of the permitted
58 ranges for priorities in each scheduling policy, see sched(7).
59
61 getrlimit(2), sched_get_priority_min(2), pthread_attr_init(3),
62 pthread_attr_setinheritsched(3), pthread_attr_setschedparam(3),
63 pthread_attr_setschedpolicy(3), pthread_create(3), pthread_self(3),
64 pthread_setschedparam(3), pthreads(7), sched(7)
65
66
67
68Linux man-pages 6.04 2023-03-30 pthread_setschedprio(3)