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

# pthread\_attr\_set\_getstackaddr(3)

thread attribute operations

## NAME

**pthread\_attr\_getstackaddr**, **pthread\_attr\_setstackaddr** – thread attribute operations

## SYNOPSIS

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

*int*\

**pthread\_attr\_getstackaddr**(*const pthread\_attr\_t \*restrict attr*, *void \*\*restrict stackaddr*);

*int*\

**pthread\_attr\_setstackaddr**(*pthread\_attr\_t \*attr*, *void \*stackaddr*);

## 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 functions  **pthread\_attr\_setstackaddr**() and  **pthread\_attr\_getstackaddr**() respectively, set and get the address at which the stack of the newly created thread should be located. The stackaddr attribute is set within the *attr* argument, which can subsequently be used as an argument to **pthread\_create**().

## RETURN VALUES

If successful, these functions return 0. Otherwise, an error number is returned to indicate the error. **pthread\_attr\_getstackaddr**() returns the stackaddr attribute value in  *stackaddr* if successful.

## ERRORS

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

- \[EINVAL\]

  Invalid value for *attr*.

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

- \[EINVAL\]

  Invalid value for *attr*.

## SEE ALSO

[pthread\_create(3)](/pthread_create/3.md), [pthread\_attr\_init(3)](/pthread_attr_init/3.md), [pthread\_attr\_setdetachstate(3)](/pthread_attr_setdetachstate/3.md), [pthread\_attr\_setstacksize(3)](/pthread_attr_setstacksize/3.md)

## STANDARDS

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