我有以下内容:
void *Thrd(void *data)
{
int ret;
ret = myfunc();
pthread_exit((void *)ret);
}
int main(int argc, char *argv[])
{
int status;
pthread_create(&Thread, NULL, Thrd, &data);
pthread_join(txThread, (void **)&status);
if (status)
printf("*** thread failed with error %d\n", status);
}
它可以工作,我可以读取状态,但我在编译时收到以下警告:
test.cpp: In function ‘void* Thrd(void*)’:
test.cpp:468:26: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
这是与pthread_exit()
我根本找不到问题所在:( ...