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

# pthread\_attr\_set\_getschedparam(3)

thread attribute operations

## NAME

**pthread\_attr\_getschedparam**, **pthread\_attr\_setschedparam** – thread attribute operations

## SYNOPSIS

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

*int*\

**pthread\_attr\_getschedparam**(*const pthread\_attr\_t \*restrict attr*, *struct sched\_param \*restrict param*);

*int*\

**pthread\_attr\_setschedparam**(*pthread\_attr\_t \*restrict attr*, *const struct sched\_param \*restrict param*);

## 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.

**pthread\_attr\_getschedparam**() and **pthread\_attr\_setschedparam**() get and set the scheduling parameters within the  *attr* argument. See **/usr/include/sched.h** for the definition of  *struct*, *sched\_param*. The  *sched\_priority* field of *struct*, *sched\_param* must be within the range returned by the [sched\_get\_priority\_min(2)](/sched_get_priority_min/2.md) and [sched\_get\_priority\_max(2)](/sched_get_priority_max/2.md) system calls.

## RETURN VALUES

If successful, these functions return 0. Otherwise, an error number is returned to indicate the error. **pthread\_attr\_getschedparam**(), on success, will copy the value of the thread's scheduling parameter attribute to the location pointed to by the second function parameter.

## ERRORS

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

- \[EINVAL\]

  Invalid value for *attr*.

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

- \[EINVAL\]

  Invalid value for *attr*.

- \[ENOTSUP\]

  Invalid value for *param*.

## SEE ALSO

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

## STANDARDS

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