1PTHREAD_ATTR_GETSCHEDPOLICY(P3OPS)IX Programmer's MaPnTuHaRlEAD_ATTR_GETSCHEDPOLICY(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_attr_getschedpolicy, pthread_attr_setschedpolicy — get and set
13 the schedpolicy attribute (REALTIME THREADS)
14
16 #include <pthread.h>
17
18 int pthread_attr_getschedpolicy(const pthread_attr_t *restrict attr,
19 int *restrict policy);
20 int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy);
21
23 The pthread_attr_getschedpolicy() and pthread_attr_setschedpolicy()
24 functions, respectively, shall get and set the schedpolicy attribute in
25 the attr argument.
26
27 The supported values of policy shall include SCHED_FIFO, SCHED_RR, and
28 SCHED_OTHER, which are defined in the <sched.h> header. When threads
29 executing with the scheduling policy SCHED_FIFO, SCHED_RR, or
30 SCHED_SPORADIC are waiting on a mutex, they shall acquire the mutex in
31 priority order when the mutex is unlocked.
32
33 The behavior is undefined if the value specified by the attr argument
34 to pthread_attr_getschedpolicy() or pthread_attr_setschedpolicy() does
35 not refer to an initialized thread attributes object.
36
38 If successful, the pthread_attr_getschedpolicy() and
39 pthread_attr_setschedpolicy() functions shall return zero; otherwise,
40 an error number shall be returned to indicate the error.
41
43 The pthread_attr_setschedpolicy() function shall fail if:
44
45 ENOTSUP
46 An attempt was made to set the attribute to an unsupported
47 value.
48
49 The pthread_attr_setschedpolicy() function may fail if:
50
51 EINVAL The value of policy is not valid.
52
53 These functions shall not return an error code of [EINTR].
54
55 The following sections are informative.
56
58 None.
59
61 After these attributes have been set, a thread can be created with the
62 specified attributes using pthread_create(). Using these routines does
63 not affect the current running thread.
64
65 See Section 2.9.4, Thread Scheduling for further details on thread
66 scheduling attributes and their default settings.
67
69 If an implementation detects that the value specified by the attr argu‐
70 ment to pthread_attr_getschedpolicy() or pthread_attr_setschedpolicy()
71 does not refer to an initialized thread attributes object, it is recom‐
72 mended that the function should fail and report an [EINVAL] error.
73
75 None.
76
78 pthread_attr_destroy(), pthread_attr_getscope(), pthread_attr_getinher‐
79 itsched(), pthread_attr_getschedparam(), pthread_create()
80
81 The Base Definitions volume of POSIX.1‐2017, <pthread.h>, <sched.h>
82
84 Portions of this text are reprinted and reproduced in electronic form
85 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
86 table Operating System Interface (POSIX), The Open Group Base Specifi‐
87 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
88 Electrical and Electronics Engineers, Inc and The Open Group. In the
89 event of any discrepancy between this version and the original IEEE and
90 The Open Group Standard, the original IEEE and The Open Group Standard
91 is the referee document. The original Standard can be obtained online
92 at http://www.opengroup.org/unix/online.html .
93
94 Any typographical or formatting errors that appear in this page are
95 most likely to have been introduced during the conversion of the source
96 files to man page format. To report such errors, see https://www.ker‐
97 nel.org/doc/man-pages/reporting_bugs.html .
98
99
100
101IEEE/The Open Group 2017 PTHREAD_ATTR_GETSCHEDPOLICY(3P)