[23][10][单选]有如下 C 语言程序:
//program Hello/ void *p_th_Hello (void *arg printf("Hello World"; pthread_exit(0; int main(void pthread_t tid; int sta; sta = pthread_create(&tid, NULL, p_th_Hello, NULL; if (sta!= 0 printf("Oops, I cannot createthread\n"; exit(0; 上述程序经正确编译链接后执行,当 pthread_exit 运行成功时,进程 hello 有多少个线程?
答案
1 个线程
解析
当一个线程完成分配给它的工作时,可以通过调用 pthread_exit 来终止,这个调用终止线程并释放它的资源。根据题意,pthread_exit 函数运行成功,线程完成并退出,所以进程中 Hello 有 1 个线程。
转载请注明出处。