xref: /netbsd-src/lib/libpthread/pthread_attr_getinheritsched.3 (revision 7330f729ccf0bd976a06f95fad452fe774fc7fd1)
1.\"	$NetBSD: pthread_attr_getinheritsched.3,v 1.4 2017/10/22 16:37:24 abhinav Exp $
2.\"
3.\" Copyright (c) 2010 Jukka Ruohonen <jruohonen@iki.fi>
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\"
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26.\" POSSIBILITY OF SUCH DAMAGE.
27.\"
28.Dd May 10, 2013
29.Dt PTHREAD_ATTR_GETINHERITSCHED 3
30.Os
31.Sh NAME
32.Nm pthread_attr_getinheritsched ,
33.Nm pthread_attr_setinheritsched
34.Nd get and set
35.Dq inheritsched
36attribute
37.Sh LIBRARY
38.Lb libpthread
39.Sh SYNOPSIS
40.In pthread.h
41.Ft int
42.Fn pthread_attr_getinheritsched \
43"const pthread_attr_t * restrict attr" "int * restrict inheritsched"
44.Ft int
45.Fn pthread_attr_setinheritsched "pthread_attr_t *attr" "int inheritsched"
46.Sh DESCRIPTION
47The
48.Fn pthread_attr_getinheritsched
49and
50.Fn pthread_attr_setinheritsched
51functions get and set, respectively, the inherit scheduler attribute,
52.Fa inheritsched ,
53in the
54.Fa attr
55object.
56The
57.Fa inheritsched
58parameter specifies whether a tread created by using
59.Fa attr
60will obtain its scheduling attributes directly from
61.Fa attr
62or whether it will inherit these from the calling thread.
63.Pp
64Two values are possible for
65.Fa inheritsched :
66.Bl -tag -width PTHREAD_EXPLICIT_SCHED -offset indent
67.It Dv PTHREAD_INHERIT_SCHED
68The thread scheduling attributes will be
69inherited from the creating thread and the ones in
70.Fa attr
71are ignored.
72.It Dv PTHREAD_EXPLICIT_SCHED
73The thread scheduling attributes will be set to the corresponding values in
74.Fa attr .
75.El
76.Pp
77The following thread scheduling attributes are affected by
78.Fa inheritsched :
79.Bl -bullet -offset indent
80.It
81Scheduling policy; see
82.Xr pthread_attr_setschedpolicy 3 .
83.It
84Scheduling parameter; see
85.Xr pthread_attr_getschedparam 3 .
86.It
87Scheduling contention scope; see
88.Xr pthread_attr_getscope 3 .
89.El
90.Sh RETURN VALUES
91If successful, both functions return 0.
92Otherwise, an error number is returned to indicate the error.
93.Sh COMPATIBILITY
94The standard leaves it unspecified which (if any) is the default
95inherit scheduler attribute in a newly initialized attribute object.
96.Sh ERRORS
97No errors are defined for
98.Fn pthread_attr_getinheritsched .
99.Pp
100The
101.Fn pthread_attr_setinheritsched
102function may fail if:
103.Bl -tag -width Er
104.It Bq Er EINVAL
105The value specified by
106.Fa inheritsched
107is invalid.
108.El
109.Sh SEE ALSO
110.Xr pthread_attr 3
111.Sh STANDARDS
112Both functions conform to
113.St -p1003.1-2008 .
114