Multithreaded Programming Guide

Getting the Thread Identifier

Use pthread_self(3C) to get the thread identifier of the calling thread.

pthread_self Syntax

pthread_t  pthread_self(void);
#include <pthread.h>

pthread_t tid;

tid = pthread_self();

pthread_self Return Values

pthread_self() returns the thread identifier of the calling thread.