マルチスレッドのプログラミング

スレッド識別子の取得

呼び出しスレッドのスレッド識別子 (thread identifier) を取得するには、 pthread_self(3C) を使用します。

pthread_self の構文

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

pthread_t tid;

tid = pthread_self();

pthread_self の戻り値

pthread_self() は、呼び出しスレッドのスレッド識別子 (thread identifier) を返します。