pthread_self(3T) は、呼び出しスレッドの識別子を取得します。
プロトタイプ: pthread_t pthread_self(void);
#include <pthread.h> pthread_t tid; tid = pthread_self();
呼び出しスレッドの識別子が戻されます。