]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/pthread_attr_setinheritsched.3
man*/: srcfix (Use .P instead of .PP or .LP)
[thirdparty/man-pages.git] / man3 / pthread_attr_setinheritsched.3
CommitLineData
a1eaacb1 1'\" t
b6a82811
MK
2.\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk
3.\" <mtk.manpages@gmail.com>
4.\"
5fbde956 5.\" SPDX-License-Identifier: Linux-man-pages-copyleft
b6a82811 6.\"
4c1c5274 7.TH pthread_attr_setinheritsched 3 (date) "Linux man-pages (unreleased)"
b6a82811
MK
8.SH NAME
9pthread_attr_setinheritsched, pthread_attr_getinheritsched \- set/get
b67b5886 10inherit-scheduler attribute in thread attributes object
c89369fb
AC
11.SH LIBRARY
12POSIX threads library
8fc3b2cf 13.RI ( libpthread ", " \-lpthread )
b6a82811
MK
14.SH SYNOPSIS
15.nf
16.B #include <pthread.h>
c6d039a3 17.P
b6a82811
MK
18.BI "int pthread_attr_setinheritsched(pthread_attr_t *" attr ,
19.BI " int " inheritsched );
161c0ae7
AC
20.BI "int pthread_attr_getinheritsched(const pthread_attr_t *restrict " attr ,
21.BI " int *restrict " inheritsched );
6030f2d8 22.fi
b6a82811
MK
23.SH DESCRIPTION
24The
25.BR pthread_attr_setinheritsched ()
b67b5886 26function sets the inherit-scheduler attribute of the
b6a82811 27thread attributes object referred to by
1ae6b2c7 28.I attr
b6a82811
MK
29to the value specified in
30.IR inheritsched .
b67b5886 31The inherit-scheduler attribute determines whether a thread created using
b6a82811
MK
32the thread attributes object
33.I attr
34will inherit its scheduling attributes from the calling thread
35or whether it will take them from
36.IR attr .
c6d039a3 37.P
c59c89b3
MK
38The following scheduling attributes are affected by the
39inherit-scheduler attribute:
40scheduling policy
41.RB ( pthread_attr_setschedpolicy (3)),
42scheduling priority
43.RB ( pthread_attr_setschedparam (3)),
44and contention scope
45.RB ( pthread_attr_setscope (3)).
c6d039a3 46.P
b6a82811
MK
47The following values may be specified in
48.IR inheritsched :
49.TP
50.B PTHREAD_INHERIT_SCHED
51Threads that are created using
52.I attr
53inherit scheduling attributes from the creating thread;
54the scheduling attributes in
55.I attr
56are ignored.
57.TP
58.B PTHREAD_EXPLICIT_SCHED
59Threads that are created using
60.I attr
61take their scheduling attributes from the values specified
62by the attributes object.
bea08fec 63.\" FIXME Document the defaults for scheduler settings
c6d039a3 64.P
b67b5886 65The default setting of the inherit-scheduler attribute in
b6a82811
MK
66a newly initialized thread attributes object is
67.BR PTHREAD_INHERIT_SCHED .
c6d039a3 68.P
b6a82811
MK
69The
70.BR pthread_attr_getinheritsched ()
b67b5886 71returns the inherit-scheduler attribute of the thread attributes object
1ae6b2c7 72.I attr
b6a82811
MK
73in the buffer pointed to by
74.IR inheritsched .
75.SH RETURN VALUE
76On success, these functions return 0;
c7094399 77on error, they return a nonzero error number.
b6a82811
MK
78.SH ERRORS
79.BR pthread_attr_setinheritsched ()
80can fail with the following error:
81.TP
82.B EINVAL
83Invalid value in
84.IR inheritsched .
c6d039a3 85.P
e29779d9 86POSIX.1 also documents an optional
b6a82811
MK
87.B ENOTSUP
88error ("attempt was made to set the attribute to an unsupported value") for
89.BR pthread_attr_setinheritsched ().
47fb8a7f 90.SH ATTRIBUTES
e4d2f415
PH
91For an explanation of the terms used in this section, see
92.BR attributes (7).
93.TS
94allbox;
c466875e 95lbx lb lb
e4d2f415
PH
96l l l.
97Interface Attribute Value
98T{
9e54434e
BR
99.na
100.nh
e4d2f415 101.BR pthread_attr_setinheritsched (),
47fb8a7f 102.BR pthread_attr_getinheritsched ()
e4d2f415
PH
103T} Thread safety MT-Safe
104.TE
3113c7f3 105.SH STANDARDS
4131356c
AC
106POSIX.1-2008.
107.SH HISTORY
108glibc 2.0.
109POSIX.1-2001.
b6a82811
MK
110.SH BUGS
111As at glibc 2.8, if a thread attributes object is initialized using
112.BR pthread_attr_init (3),
113then the scheduling policy of the attributes object is set to
1ae6b2c7 114.B SCHED_OTHER
b6a82811 115and the scheduling priority is set to 0.
b67b5886 116However, if the inherit-scheduler attribute is then set to
b6a82811
MK
117.BR PTHREAD_EXPLICIT_SCHED ,
118then a thread created using the attribute object
119wrongly inherits its scheduling attributes from the creating thread.
120This bug does not occur if either the scheduling policy or
121scheduling priority attribute is explicitly set
122in the thread attributes object before calling
123.BR pthread_create (3).
124.\" FIXME . Track status of the following bug:
125.\" http://sourceware.org/bugzilla/show_bug.cgi?id=7007
a14af333 126.SH EXAMPLES
22cb459d
MK
127See
128.BR pthread_setschedparam (3).
b6a82811 129.SH SEE ALSO
ca8a0bd2
MK
130.ad l
131.nh
b6a82811
MK
132.BR pthread_attr_init (3),
133.BR pthread_attr_setschedparam (3),
134.BR pthread_attr_setschedpolicy (3),
c59c89b3 135.BR pthread_attr_setscope (3),
b6a82811
MK
136.BR pthread_create (3),
137.BR pthread_setschedparam (3),
138.BR pthread_setschedprio (3),
3e2cae49 139.BR pthreads (7),
25ac8173 140.BR sched (7)