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

# pthread\_self(3)

get the calling thread's ID

## NAME

**pthread\_self** – get the calling thread's ID

## SYNOPSIS

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

*pthread\_t*\

**pthread\_self**(*void*);

## DESCRIPTION

The **pthread\_self**() function returns the thread ID of the calling thread.

## RETURN VALUES

The **pthread\_self**() function returns the thread ID of the calling thread.

## ERRORS

None.

## SEE ALSO

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

## STANDARDS

The **pthread\_self**() function conforms to ISO/IEC 9945-1:1996 (“POSIX.1”).
