1
.\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk
2
.\" <mtk.manpages@gmail.com>
4
.\" Permission is granted to make and distribute verbatim copies of this
5
.\" manual provided the copyright notice and this permission notice are
6
.\" preserved on all copies.
8
.\" Permission is granted to copy and distribute modified versions of this
9
.\" manual under the conditions for verbatim copying, provided that the
10
.\" entire resulting derived work is distributed under the terms of a
11
.\" permission notice identical to this one.
13
.\" Since the Linux kernel and libraries are constantly changing, this
14
.\" manual page may be incorrect or out-of-date. The author(s) assume no
15
.\" responsibility for errors or omissions, or for damages resulting from
16
.\" the use of the information contained herein. The author(s) may not
17
.\" have taken the same level of care in the production of this manual,
18
.\" which is licensed free of charge, as they might when working
21
.\" Formatted or processed versions of this manual, if unaccompanied by
22
.\" the source, must acknowledge the copyright and authors of this work.
24
.TH PTHREAD_ATTR_SETINHERITSCHED 3 2008-11-10 "Linux" "Linux Programmer's Manual"
26
pthread_attr_setinheritsched, pthread_attr_getinheritsched \- set/get
27
inherit scheduler attribute in thread attributes object
30
.B #include <pthread.h>
32
.BI "int pthread_attr_setinheritsched(pthread_attr_t *" attr ,
33
.BI " int " inheritsched );
34
.BI "int pthread_attr_getinheritsched(pthread_attr_t *" attr ,
35
.BI " int *" inheritsched );
37
Compile and link with \fI\-pthread\fP.
40
.BR pthread_attr_setinheritsched ()
41
function sets the inherit scheduler attribute of the
42
thread attributes object referred to by
44
to the value specified in
46
The inherit scheduler attribute determines whether a thread created using
47
the thread attributes object
49
will inherit its scheduling attributes from the calling thread
50
or whether it will take them from
53
The following values may be specified in
56
.B PTHREAD_INHERIT_SCHED
57
Threads that are created using
59
inherit scheduling attributes from the creating thread;
60
the scheduling attributes in
64
.B PTHREAD_EXPLICIT_SCHED
65
Threads that are created using
67
take their scheduling attributes from the values specified
68
by the attributes object.
69
.\" FIXME what are the defaults for scheduler settings?
71
The default setting of the inherit scheduler attribute in
72
a newly initialized thread attributes object is
73
.BR PTHREAD_INHERIT_SCHED .
76
.BR pthread_attr_getinheritsched ()
77
returns the inherit scheduler attribute of the thread attributes object
79
in the buffer pointed to by
82
On success, these functions return 0;
83
on error, they return a non-zero error number.
85
.BR pthread_attr_setinheritsched ()
86
can fail with the following error:
92
POSIX.1-2001 also documents an optional
94
error ("attempt was made to set the attribute to an unsupported value") for
95
.BR pthread_attr_setinheritsched ().
97
.\" Available since glibc 2.0.
102
.BR pthread_setschedparam (3).
104
As at glibc 2.8, if a thread attributes object is initialized using
105
.BR pthread_attr_init (3),
106
then the scheduling policy of the attributes object is set to
108
and the scheduling priority is set to 0.
109
However, if the inherit scheduler attribute is then set to
110
.BR PTHREAD_EXPLICIT_SCHED ,
111
then a thread created using the attribute object
112
wrongly inherits its scheduling attributes from the creating thread.
113
This bug does not occur if either the scheduling policy or
114
scheduling priority attribute is explicitly set
115
in the thread attributes object before calling
116
.BR pthread_create (3).
117
.\" FIXME . Track status of the following bug:
118
.\" http://sourceware.org/bugzilla/show_bug.cgi?id=7007
120
.BR sched_setscheduler (2),
121
.BR pthread_attr_init (3),
122
.BR pthread_attr_setschedparam (3),
123
.BR pthread_attr_setschedpolicy (3),
124
.BR pthread_create (3),
125
.BR pthread_setschedparam (3),
126
.BR pthread_setschedprio (3),
129
This page is part of release 3.14 of the Linux
132
A description of the project,
133
and information about reporting bugs,
135
http://www.kernel.org/doc/man-pages/.