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