函数pthread_self()
将给出当前线程的线程ID.
pthread_t pthread_self(void);
pthread_self()
函数返回调用线程的Pthread句柄.pthread_self()函数不返回调用线程的整数线程.必须使用pthread_getthreadid_np()
返回线程的整数标识符.
注:
pthread_id_np_t tid;
tid = pthread_getthreadid_np();
速度明显快于这些调用,但提供相同的行为.
pthread_id_np_t tid;
pthread_t self;
self = pthread_self();
pthread_getunique_np(&self, &tid);