xref: /netbsd-src/lib/libpthread/pthread_attr_getinheritsched.3 (revision b1c86f5f087524e68db12794ee9c3e3da1ab17a0)
1.\"	$NetBSD: pthread_attr_getinheritsched.3,v 1.2 2010/07/08 18:15:27 wiz 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 July 7, 2010
29.Dt PTHREAD_ATTR_GETINHERITEDSCHED 3
30.Os
31.Sh NAME
32.Nm pthread_attr_getinheritedsched
33.Nd get and set
34.Dq inheritsched
35attribute
36.Sh LIBRARY
37.Lb libpthread
38.Sh SYNOPSIS
39.In pthread.h
40.Ft int
41.Fn pthread_attr_getinheritsched \
42"const pthread_attr_t * restrict attr" "int * restrict inheritsched"
43.Ft int
44.Fn pthread_attr_setinheritsched "pthread_attr_t *attr" "int inheritsched"
45.Sh DESCRIPTION
46The
47.Fn pthread_attr_getinheritsched
48and
49.Fn pthread_attr_setinheritsched
50functions get and set, respectively, the inherit scheduler attribute,
51.Fa inheritsched ,
52in the
53.Fa attr
54object.
55The
56.Fa inheritsched
57parameter specifies whether a tread created by using
58.Fa attr
59will obtain its scheduling attributes directly from
60.Fa attr
61or whether it will inherit these from the calling thread.
62.Pp
63Two values are possible for
64.Fa inheritsched :
65.Bl -tag -width PTHREAD_EXPLICIT_SCHED -offset indent
66.It Dv PTHREAD_INHERIT_SCHED
67The thread scheduling attributes will be
68inherited from the creating thread and the ones in
69.Fa attr
70are ignored.
71.It Dv PTHREAD_EXPLICIT_SCHED
72The thread scheduling attributes will be set to the corresponding values in
73.Fa attr .
74.El
75.Pp
76The following thread scheduling attributes are affected by
77.Fa inheritsched :
78.Bl -bullet -offset indent
79.It
80Scheduling policy; see
81.Xr pthread_attr_setschedpolicy 3 .
82.It
83Scheduling parameter; see
84.Xr pthread_attr_getschedparam 3 .
85.It
86Scheduling contention scope; see
87.Xr pthread_attr_getscope 3 .
88.El
89.Sh RETURN VALUES
90If successful, both functions return 0.
91Otherwise, an error number is returned to indicate the error.
92.Sh COMPATIBILITY
93The standard leaves it unspecified which (if any) is the default
94inherit scheduler attribute in a newly initialized attribute object.
95.Sh ERRORS
96No errors are defined for
97.Fn pthread_attr_getinheritsched .
98.Pp
99The
100.Fn pthread_attr_setinheritsched
101function may fail if:
102.Bl -tag -width Er
103.It Bq Er EINVAL
104The value specified by
105.Fa inheritsched
106is invalid.
107.El
108.Sh SEE ALSO
109.Xr pthread_attr 3
110.Sh STANDARDS
111Both functions conform to
112.St -p1003.1-2008 .
113