.\" $NetBSD: pthread_attr_getinheritsched.3,v 1.4 2017/10/22 16:37:24 abhinav Exp $
.\"
.\" Copyright (c) 2010 Jukka Ruohonen <jruohonen@iki.fi>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\"
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd May 10, 2013
.Dt PTHREAD_ATTR_GETINHERITSCHED 3
.Os
.Sh NAME
.Nm pthread_attr_getinheritsched ,
.Nm pthread_attr_setinheritsched
.Nd get and set
.Dq inheritsched
attribute
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In pthread.h
.Ft int
.Fn pthread_attr_getinheritsched \
"const pthread_attr_t * restrict attr" "int * restrict inheritsched"
.Ft int
.Fn pthread_attr_setinheritsched "pthread_attr_t *attr" "int inheritsched"
.Sh DESCRIPTION
The
.Fn pthread_attr_getinheritsched
and
.Fn pthread_attr_setinheritsched
functions get and set, respectively, the inherit scheduler attribute,
.Fa inheritsched ,
in the
.Fa attr
object.
The
.Fa inheritsched
parameter specifies whether a tread created by using
.Fa attr
will obtain its scheduling attributes directly from
.Fa attr
or whether it will inherit these from the calling thread.
.Pp
Two values are possible for
.Fa inheritsched :
.Bl -tag -width PTHREAD_EXPLICIT_SCHED -offset indent
.It Dv PTHREAD_INHERIT_SCHED
The thread scheduling attributes will be
inherited from the creating thread and the ones in
.Fa attr
are ignored.
.It Dv PTHREAD_EXPLICIT_SCHED
The thread scheduling attributes will be set to the corresponding values in
.Fa attr .
.El
.Pp
The following thread scheduling attributes are affected by
.Fa inheritsched :
.Bl -bullet -offset indent
.It
Scheduling policy; see
.Xr pthread_attr_setschedpolicy 3 .
.It
Scheduling parameter; see
.Xr pthread_attr_getschedparam 3 .
.It
Scheduling contention scope; see
.Xr pthread_attr_getscope 3 .
.El
.Sh RETURN VALUES
If successful, both functions return 0.
Otherwise, an error number is returned to indicate the error.
.Sh COMPATIBILITY
The standard leaves it unspecified which (if any) is the default
inherit scheduler attribute in a newly initialized attribute object.
.Sh ERRORS
No errors are defined for
.Fn pthread_attr_getinheritsched .
.Pp
The
.Fn pthread_attr_setinheritsched
function may fail if:
.Bl -tag -width Er
.It Bq Er EINVAL
The value specified by
.Fa inheritsched
is invalid.
.El
.Sh SEE ALSO
.Xr pthread_attr 3
.Sh STANDARDS
Both functions conform to
.St -p1003.1-2008 .