---
name: "PAPI_thread_id"
section: "3"
platform: "linux"
package: "libpapi-dev"
version: "7.1.0-5+b1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/PAPI_thread_id"
---

# PAPI\_thread\_id(3)

Get the thread identifier of the current thread.

## NAME

PAPI\_thread\_id - Get the thread identifier of the current thread.

## SYNOPSIS

## Detailed Description

**Return values**

*PAPI\_EMISC* is returned if there are no threads registered. \
 *-1* is returned if the thread id function returns an error.

This function returns a valid thread identifier. It calls the function registered with PAPI through a call to **PAPI\_thread\_init()**.

```
unsigned long tid;
if ((tid = PAPI_thread_id()) == (unsigned long int)-1 )
    exit(1);
printf("Initial thread id is: %lu\n", tid );
```

**See also**

**PAPI\_thread\_init**

## Author

Generated automatically by Doxygen for PAPI from the source code.
