#include
#include
void *threadx (void *arg)
{
pthread_detach (pthread_self ());
printf ("thread exit.\n");
return NULL;
}
int main (int argc, char **argv)
{
pthread tid;
pthread_create (&tid, NULL, threadx, NULL);
while (1);
reutnr 0;
}
程序运行后,thread exit 打印了,然后使用ps命令查看,出现两个不同PID但是名称相同的进程,轮道理子线程退出后只剩下一个线程,为什么会出现这种情况呢?