[15][9][单选]对于如下 C 语言程序
void *th_f(void *arg { printf("Hello World"; pthread_exit(0; } int main(void { pthread_t tid; int st; st = pthread_create(&tid, NULL, th_f, NULL; if (st == 0 printf("Oops, I can not createthread\n"; exit(0; } 在上述程序中,pthread_exit 函数的意义是
线程 th_f 运行后成为僵尸
线程 th_f 运行后等待一个特定的线程退出
线程 th_f 运行后主动将 CPU 给其他线程
线程 th_f 运行后正常退出
答案
线程 th_f 运行后正常退出
解析
线程通过调用 pthread_exit 函数终止运行,类似进程调用 exit 函数,它会终止调用它的线程并返回一个指向某个对象的指针。
【涉及考点】
第3章 进程线程模型
转载请注明出处。