---
name: "pthread_self"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
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

## LIBRARY

POSIX Threads Library (libpthread, -lpthread)

## 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), [pthread\_getthreadid\_np(3)](/pthread_getthreadid_np/3.md)

## STANDARDS

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