1PTHREAD_SETSCHEDPRIO(3P) POSIX Programmer's Manual PTHREAD_SETSCHEDPRIO(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 pthread_setschedprio — dynamic thread scheduling parameters access
13 (REALTIME THREADS)
14
16 #include <pthread.h>
17
18 int pthread_setschedprio(pthread_t thread, int prio);
19
21 The pthread_setschedprio() function shall set the scheduling priority
22 for the thread whose thread ID is given by thread to the value given by
23 prio. See Scheduling Policies for a description on how this function
24 call affects the ordering of the thread in the thread list for its new
25 priority.
26
27 If the pthread_setschedprio() function fails, the scheduling priority
28 of the target thread shall not be changed.
29
31 If successful, the pthread_setschedprio() function shall return zero;
32 otherwise, an error number shall be returned to indicate the error.
33
35 The pthread_setschedprio() function may fail if:
36
37 EINVAL The value of prio is invalid for the scheduling policy of the
38 specified thread.
39
40 EPERM The caller does not have appropriate privileges to set the
41 scheduling priority of the specified thread.
42
43 The pthread_setschedprio() function shall not return an error code of
44 [EINTR].
45
46 The following sections are informative.
47
49 None.
50
52 None.
53
55 The pthread_setschedprio() function provides a way for an application
56 to temporarily raise its priority and then lower it again, without hav‐
57 ing the undesired side-effect of yielding to other threads of the same
58 priority. This is necessary if the application is to implement its own
59 strategies for bounding priority inversion, such as priority inheri‐
60 tance or priority ceilings. This capability is especially important if
61 the implementation does not support the Thread Priority Protection or
62 Thread Priority Inheritance options, but even if those options are sup‐
63 ported it is needed if the application is to bound priority inheritance
64 for other resources, such as semaphores.
65
66 The standard developers considered that while it might be preferable
67 conceptually to solve this problem by modifying the specification of
68 pthread_setschedparam(), it was too late to make such a change, as
69 there may be implementations that would need to be changed. Therefore,
70 this new function was introduced.
71
72 If an implementation detects use of a thread ID after the end of its
73 lifetime, it is recommended that the function should fail and report an
74 [ESRCH] error.
75
77 None.
78
80 Scheduling Policies, pthread_getschedparam()
81
82 The Base Definitions volume of POSIX.1‐2017, <pthread.h>
83
85 Portions of this text are reprinted and reproduced in electronic form
86 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
87 table Operating System Interface (POSIX), The Open Group Base Specifi‐
88 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
89 Electrical and Electronics Engineers, Inc and The Open Group. In the
90 event of any discrepancy between this version and the original IEEE and
91 The Open Group Standard, the original IEEE and The Open Group Standard
92 is the referee document. The original Standard can be obtained online
93 at http://www.opengroup.org/unix/online.html .
94
95 Any typographical or formatting errors that appear in this page are
96 most likely to have been introduced during the conversion of the source
97 files to man page format. To report such errors, see https://www.ker‐
98 nel.org/doc/man-pages/reporting_bugs.html .
99
100
101
102IEEE/The Open Group 2017 PTHREAD_SETSCHEDPRIO(3P)