Multithreaded Programming Guide

pthread_self(3THR)

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

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

pthread_t tid;

tid = pthread_self();

Return Values

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