有什么办法可以让创建的线程知道⑦线程标识符么

用函数

int  pthread_create (
pthread_t  *tidp, 
pthread_attr_t  *attr,
void*(*start_routine) (void *),
void *arg
); 

创建的线程,有什么办法让线程起始函数start_routine得到tidp这个线程标识符的值?
PS: pthread_self()函数得到的值不是其线程标识符

阅读 2.4k
1 个回答

The pthread_self() function returns the ID of the calling thread. This is the same value that is returned in *thread in the pthread_create(3) call that created this thread.
手册里明确这么写了,就是同一个值。你把你调用的代码块贴出来吧。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题