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