---
name: "pthread_attr_set_getinheritsched"
section: "3"
platform: "macos"
package: "libpthread"
version: "539.100.4"
release: "macOS 26.5"
platforms: ["macos"]
url: "https://new.carta.tech/pthread_attr_set_getinheritsched"
---

# pthread\_attr\_set\_getinheritsched(3)

thread attribute operations

## NAME

**pthread\_attr\_getinheritsched**, **pthread\_attr\_setinheritsched** – thread attribute operations

## SYNOPSIS

**#include \<pthread.h\>**

*int*\

**pthread\_attr\_getinheritsched**(*const pthread\_attr\_t \*restrict attr*, *int \*restrict inheritsched*);

*int*\

**pthread\_attr\_setinheritsched**(*pthread\_attr\_t \*attr*, *int inheritsched*);

## DESCRIPTION

Thread attributes are used to specify parameters to **pthread\_create**(). One attribute object can be used in multiple calls to **pthread\_create**(), with or without modifications between calls.

One of the thread attributes of interest is the "inheritsched" attribute. This attribute controls the scheduling policy and related attributes of the newly created thread. The values of the  "inheritsched" attribute can be either PTHREAD\_INHERIT\_SCHED or PTHREAD\_EXPLICIT\_SCHED.

PTHREAD\_INHERIT\_SCHED

	Indicates that the newly created thread should inherit all it's scheduling related attributes from it's creating thread. It ignores the values of the relevant attributes within the *attr* argument.

PTHREAD\_EXPLICIT\_SCHED

	Indicates that the newly created thread should set it's scheduling related attributes based on  *attr* argument.

The **pthread\_attr\_setinheritsched**() functions set the "inheritsched" attribute within the *attr* argument to the desired value.

The **pthread\_attr\_getinheritsched**() functions copy the value of the "inheritsched" attribute to the location pointed to by the second function parameter.

## RETURN VALUES

If successful, these functions return 0. Otherwise, an error number is returned to indicate the error.

## ERRORS

**pthread\_attr\_getinheritsched**() will fail if:

- \[EINVAL\]

  Invalid value for *attr*.

**pthread\_attr\_setinheritsched**() will fail if:

- \[EINVAL\]

  Invalid value for *attr*.

## BUGS

The "inheritsched" attribute has no effect on Darwin.  It is provided for compatibility only.

## SEE ALSO

[pthread\_create(3)](/pthread_create/3.md), [pthread\_attr\_init(3)](/pthread_attr_init/3.md), [pthread\_attr\_setschedparam(3)](/pthread_attr_setschedparam/3.md)

## STANDARDS

**pthread\_attr\_setinheritsched**(), **pthread\_attr\_getinheritsched**() conform to Version 2 of the Single UNIX Specification (“SUSv2”)
