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

# pthread\_attr\_set\_getscope(3)

thread attribute operations

## NAME

**pthread\_attr\_getscope**, **pthread\_attr\_setscope** – thread attribute operations

## SYNOPSIS

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

*int*\

**pthread\_attr\_getscope**(*const pthread\_attr\_t \*restrict attr*, *int \*restrict contentionscope*);

*int*\

**pthread\_attr\_setscope**(*pthread\_attr\_t \*attr*, *int contentionscope*);

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

The  **pthread\_attr\_setscope**() and  **pthread\_attr\_getscope**() functions, respectively, set and get the attribute within *attr* argument that controls the contention scope of the thread. The acceptable values are PTHREAD\_SCOPE\_SYSTEM, indicating a scheduling contention scope that is system-wide, and PTHREAD\_SCOPE\_PROCESS, which indicates a process scheduling contention scope. Currently on Mac OS X we only support PTHREAD\_SCOPE\_SYSTEM.

## RETURN VALUES

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

## ERRORS

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

- \[EINVAL\]

  Invalid value for *attr*.

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

- \[EINVAL\]

  Invalid value for *attr*.

- \[ENOTSUP\]

  Invalid or unsupported value for *contentionscope*.

## 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), [pthread\_attr\_setschedpolicy(3)](/pthread_attr_setschedpolicy/3.md), [pthread\_attr\_setschedparam(3)](/pthread_attr_setschedparam/3.md)

## STANDARDS

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