[14][10][单选]对于如下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;
}
答案
线程th_f运行后正常退出
解析
线程通过调用pthread_exit函数终止运行,就如同进程在结束时调用exit函数一样。这个函数的作用是:终止调用它的线程并返回一个指向某个对象的指针。故选择D选项。
【涉及考点】
第3章 进程线程模型
转载请注明出处。