呼び出しスレッドのスレッド識別子 (thread identifier) を取得するには、 pthread_self(3C) を使用します。
pthread_t pthread_self(void);
#include <pthread.h> pthread_t tid; tid = pthread_self();
pthread_self() は、呼び出しスレッドのスレッド識別子 (thread identifier) を返します。