1PTHREAD_SETSCHEDPRIO(P) POSIX Programmer's Manual PTHREAD_SETSCHEDPRIO(P)
2
3
4
6 pthread_setschedprio - dynamic thread scheduling parameters access
7 (REALTIME THREADS)
8
10 #include <pthread.h>
11
12 int pthread_setschedprio(pthread_t thread, int prio);
13
14
16 The pthread_setschedprio() function shall set the scheduling priority
17 for the thread whose thread ID is given by thread to the value given by
18 prio. See Scheduling Policies for a description on how this function
19 call affects the ordering of the thread in the thread list for its new
20 priority.
21
22 If the pthread_setschedprio() function fails, the scheduling priority
23 of the target thread shall not be changed.
24
26 If successful, the pthread_setschedprio() function shall return zero;
27 otherwise, an error number shall be returned to indicate the error.
28
30 The pthread_setschedprio() function may fail if:
31
32 EINVAL The value of prio is invalid for the scheduling policy of the
33 specified thread.
34
35 ENOTSUP
36 An attempt was made to set the priority to an unsupported value.
37
38 EPERM The caller does not have the appropriate permission to set the
39 scheduling policy of the specified thread.
40
41 EPERM The implementation does not allow the application to modify the
42 priority to the value specified.
43
44 ESRCH The value specified by thread does not refer to an existing
45 thread.
46
47
48 The pthread_setschedprio() function shall not return an error code of
49 [EINTR].
50
51 The following sections are informative.
52
54 None.
55
57 None.
58
60 The pthread_setschedprio() function provides a way for an application
61 to temporarily raise its priority and then lower it again, without hav‐
62 ing the undesired side effect of yielding to other threads of the same
63 priority. This is necessary if the application is to implement its own
64 strategies for bounding priority inversion, such as priority inheri‐
65 tance or priority ceilings. This capability is especially important if
66 the implementation does not support the Thread Priority Protection or
67 Thread Priority Inheritance options, but even if those options are sup‐
68 ported it is needed if the application is to bound priority inheritance
69 for other resources, such as semaphores.
70
71 The standard developers considered that while it might be preferable
72 conceptually to solve this problem by modifying the specification of
73 pthread_setschedparam(), it was too late to make such a change, as
74 there may be implementations that would need to be changed. Therefore,
75 this new function was introduced.
76
78 None.
79
81 Scheduling Policies , pthread_getschedparam() , the Base Definitions
82 volume of IEEE Std 1003.1-2001, <pthread.h>
83
85 Portions of this text are reprinted and reproduced in electronic form
86 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
87 -- Portable Operating System Interface (POSIX), The Open Group Base
88 Specifications Issue 6, Copyright (C) 2001-2003 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
96
97IEEE/The Open Group 2003 PTHREAD_SETSCHEDPRIO(P)