1pthread_attr_getschedpolicSyt(a3nCd)ard C Library Funcpttihornesad_attr_getschedpolicy(3C)
2
3
4
6 pthread_attr_getschedpolicy, pthread_attr_setschedpolicy - get or set
7 schedpolicy attribute
8
10 cc -mt [ flag... ] file... -lpthread [ library... ]
11 #include <pthread.h>
12
13 int pthread_attr_getschedpolicy(const pthread_attr_t *restrict attr,
14 int *restrict policy);
15
16
17 int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy);
18
19
21 The functions pthread_attr_setschedpolicy() and pthread_attr_getsched‐
22 policy(), respectively, set and get the schedpolicy attribute in the
23 attr argument.
24
25
26 Supported values of policy include SCHED_FIFO, SCHED_RR and
27 SCHED_OTHER, which are defined by the header <sched.h>. When threads
28 executing with the scheduling policy SCHED_FIFO or SCHED_RR are wait‐
29 ing on a mutex, they acquire the mutex in priority order when the mutex
30 is unlocked.
31
32
33 See sched.h(3HEAD) for a description of all defined policy values.
34 Valid policy values can also be obtained from pthread_getschedparam(3C)
35 and sched_getscheduler(3C).
36
38 If successful, the pthread_attr_setschedpolicy() and
39 pthread_attr_getschedpolicy() functions return 0. Otherwise, an error
40 number is returned to indicate the error.
41
43 The pthread_attr_setschedpolicy() or pthread_attr_getschedpolicy()
44 function may fail if:
45
46 EINVAL attr or policy is invalid.
47
48
50 After these attributes have been set, a thread can be created with the
51 specified attributes using pthread_create(). Using these routines does
52 not affect the current running thread.
53
55 See attributes(5) for descriptions of the following attributes:
56
57
58
59
60 ┌─────────────────────────────┬─────────────────────────────┐
61 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
62 ├─────────────────────────────┼─────────────────────────────┤
63 │Interface Stability │Committed │
64 ├─────────────────────────────┼─────────────────────────────┤
65 │MT-Level │MT-Safe │
66 ├─────────────────────────────┼─────────────────────────────┤
67 │Standard │See standards(5). │
68 └─────────────────────────────┴─────────────────────────────┘
69
71 pthread_attr_init(3C), pthread_attr_setscope(3C), pthread_attr_set‐
72 inheritsched(3C), pthread_attr_setschedparam(3C), pthread_create(3C),
73 pthread_getschedparam(3C), sched.h(3HEAD), sched_getscheduler(3C),
74 attributes(5), standards(5)
75
76
77
78SunOS 5.11 1 Apr 2008 pthread_attr_getschedpolicy(3C)