---
name: "pthread_equal"
section: "3"
platform: "linux"
package: "man-pages"
version: "6.19-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux", "freebsd", "macos"]
url: "https://new.carta.tech/pthread_equal"
---

# pthread\_equal(3)

compare thread IDs

## NAME

pthread\_equal - compare thread IDs

## LIBRARY

POSIX threads library (*libpthread*, *-lpthread*)

## SYNOPSIS

```
#include <pthread.h>
```

**int pthread\_equal(pthread\_t** *t1***, pthread\_t** *t2***);**

## DESCRIPTION

The **pthread\_equal**() function compares two thread identifiers.

## RETURN VALUE

If the two thread IDs are equal, **pthread\_equal**() returns a nonzero value; otherwise, it returns 0.

## ERRORS

This function always succeeds.

## ATTRIBUTES

For an explanation of the terms used in this section, see [**attributes**(7)](/attributes/7.md).

| | | |
| --- | --- | --- |
| **Interface** | **Attribute** | **Value** |
| **pthread\_equal**() | Thread safety | MT-Safe |

## STANDARDS

POSIX.1-2008.

## HISTORY

POSIX.1-2001.

## NOTES

The **pthread\_equal**() function is necessary because thread IDs should be considered opaque: there is no portable way for applications to directly compare two *pthread\_t* values.

## SEE ALSO

[**pthread\_create**(3)](/pthread_create/3.md), [**pthread\_self**(3)](/pthread_self/3.md), [**pthreads**(7)](/pthreads/7.md)
