用函数
int pthread_create (
pthread_t *tidp,
pthread_attr_t *attr,
void*(*start_routine) (void *),
void *arg
);
创建的线程,有什么办法让线程起始函数start_routine得到tidp这个线程标识符的值?
PS: pthread_self()函数得到的值不是其线程标识符
用函数
int pthread_create (
pthread_t *tidp,
pthread_attr_t *attr,
void*(*start_routine) (void *),
void *arg
);
创建的线程,有什么办法让线程起始函数start_routine得到tidp这个线程标识符的值?
PS: pthread_self()函数得到的值不是其线程标识符
7 回答5.3k 阅读
4 回答4k 阅读
2 回答5.9k 阅读✓ 已解决
2 回答2.5k 阅读✓ 已解决
1 回答2.3k 阅读✓ 已解决
2 回答799 阅读✓ 已解决
1 回答3.3k 阅读
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.
手册里明确这么写了,就是同一个值。你把你调用的代码块贴出来吧。