1pthread_getschedparam(3C)Standard C Library Functionspthread_getschedparam(3C)
2
3
4
6 pthread_getschedparam, pthread_setschedparam - access dynamic thread
7 scheduling parameters
8
10 cc -mt [ flag... ] file... -lpthread [ library... ]
11 #include <pthread.h>
12
13 int pthread_getschedparam(pthread_t thread, int *restrict policy,
14 struct sched_param *restrict param);
15
16
17 int pthread_setschedparam(pthread_t thread, int policy,
18 const struct sched_param *param);
19
20
22 The pthread_getschedparam() and pthread_setschedparam() functions allow
23 the scheduling policy and scheduling parameters of individual threads
24 within a multithreaded process to be retrieved and set. Supported poli‐
25 cies are :
26
27 SCHED_OTHER traditional time-sharing scheduling class
28
29
30 SCHED_FIFO real-time class: run to completion
31
32
33 SCHED_RR real-time class: round-robin
34
35
36 SCHED_IA interactive time-sharing class
37
38
39 SCHED_FSS fair-share scheduling class
40
41
42 SCHED_FX fixed priority scheduling class
43
44
45
46 See pthreads(5). The affected scheduling parameter is the sched_prior‐
47 ity member of the sched_param structure.
48
49
50 The pthread_getschedparam() function retrieves the scheduling policy
51 and scheduling parameters for the thread whose thread ID is given by
52 thread and stores those values in policy and param, respectively. The
53 priority value returned from pthread_getschedparam() is the value spec‐
54 ified by the most recent pthread_setschedparam() or pthread_create()
55 call affecting the target thread, and does not reflect any temporary
56 adjustments to its priority as a result of any priority inheritance or
57 ceiling functions. The pthread_setschedparam() function sets the sched‐
58 uling policy and associated scheduling parameters for the thread whose
59 thread ID is given by thread to the policy and associated parameters
60 provided in policy and param, respectively.
61
62
63 If the pthread_setschedparam() function fails, no scheduling parameters
64 will be changed for the target thread.
65
67 If successful, the pthread_getschedparam() and pthread_setschedparam()
68 functions return 0. Otherwise, an error number is returned to indicate
69 the error.
70
72 The pthread_getschedparam() and pthread_gsetschedparam() functions will
73 fail if:
74
75 ESRCH The value specified by thread does not refer to an existing
76 thread.
77
78
79
80 The pthread_setschedparam() function will fail if:
81
82 EINVAL The value specified by policy or one of the scheduling param‐
83 eters associated with the scheduling policy policy is
84 invalid.
85
86
87 EPERM The caller does not have the appropriate permission to set
88 either the scheduling parameters or the scheduling policy of
89 the specified thread.
90
91
93 See attributes(5) for descriptions of the following attributes:
94
95
96
97
98 ┌─────────────────────────────┬─────────────────────────────┐
99 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
100 ├─────────────────────────────┼─────────────────────────────┤
101 │Interface Stability │Committed │
102 ├─────────────────────────────┼─────────────────────────────┤
103 │MT-Level │MT-Safe │
104 ├─────────────────────────────┼─────────────────────────────┤
105 │Standard │See standards(5). │
106 └─────────────────────────────┴─────────────────────────────┘
107
109 pthread_attr_init(3C), sched_getparam(3C), sched_get_prior‐
110 ity_max(3C)sched_get_priority_max(3C), sched_get_priority_min(3C),
111 sched_setparam(3C), sched_getscheduler(3C), sched_setscheduler(3C),
112 attributes(5), pthreads(5), standards(5)
113
114
115
116SunOS 5.11 1 Apr 2008 pthread_getschedparam(3C)