使用self thread-id定义调用join的行为

时间:2014-11-16 06:01:21

标签: c multithreading

以下C语句的行为是什么: pthread_join(pthread_self(),NULL);

这是否意味着该线程无法加入任何其他线程?

1 个答案:

答案 0 :(得分:1)

它产生未定义的行为:

如果pthread_join()的thread参数指定的值引用调用线程

,则行为未定义

其中thread参数是第一个参数,而调用线程的情况是pthread_self():

                             v
int pthread_join(pthread_t thread, void **value_ptr);

http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_join.html