ead_create thread_a"); } err = pthread_create(&tid_b,null,thread_b,null); if(err < 0) { perror("pthread_create thread_a"); } sleep(5); printf("the main close\n"); return 0; } 程序运行结果: thread a enter pid = 3b89, posix_tid = b7fd4b90, linux_tid = 3b8a thread b enter pid = 3b89, posix_tid = b75d3b90, linux_tid = 3b8b the main close 通过这个函数我们可以发现posix提供的这个id不是很有规律,而linux内核为线程提供的id是经跟在主进程进程号的数字,如上面程序中主进程id为3b89而两个线程的id分别为3b8a,3b8b。 “本文由华清远见http://w