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

# pthread\_attr\_init\_destroy(3)

thread attribute operations

## NAME

**pthread\_attr\_destroy**, **pthread\_attr\_init** – thread attribute operations

## SYNOPSIS

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

*int*\

**pthread\_attr\_destroy**(*pthread\_attr\_t \*attr*);

*int*\

**pthread\_attr\_init**(*pthread\_attr\_t \*attr*);

## 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\_init**() function initializes *attr* with all the default thread attributes.

The **pthread\_attr\_destroy**() function destroys *attr*.

## RETURN VALUES

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

## ERRORS

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

- \[ENOMEM\]

  Out of memory.

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

- \[EINVAL\]

  Invalid value for *attr*.

## SEE ALSO

[pthread\_create(3)](/pthread_create/3.md)

## STANDARDS

**pthread\_attr\_init**(), **pthread\_attr\_destroy**() conform to ISO/IEC 9945-1:1996 (“POSIX.1”)
