Multithreaded Programming Guide

thr_self(3T)

Use thr_self(3T) to get the ID of the calling thread.

#include <thread.h>

thread_t thr_self(void);