请使用 pthread_self(3C) 获取调用线程的 thread identifier。
pthread_t pthread_self(void);
#include <pthread.h> pthread_t tid; tid = pthread_self();
pthread_self() 返回调用线程的 thread identifier。