int pthread_join(pthread_t thread, void **retval);
根据手册页 pthread_join 应该使用指向指针的指针作为参数来存储返回值。我不明白为什么它会这样设计。在其中使用指针变量就足够了吗?
int pthread_join(pthread_t thread, void **retval);
根据手册页 pthread_join 应该使用指向指针的指针作为参数来存储返回值。我不明白为什么它会这样设计。在其中使用指针变量就足够了吗?
如果我清楚地理解了您的查询..您应该这样使用..
pthread_t a_thread;
void *thread_result;
pthread_join(a_thread, &thread_result);
您传递给的 start 例程pthread_create返回 type 的值Foobar。我不知道是什么Foobar,但如果你想在 中捕获那个值pthread_join,你必须传入一个Foobar*。
现在,当我查看pthread_create文档时,我发现它Foobar实际上是void*. 因此pthread_join应该接受void**。