[12][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 create thread\n"); exit(NULL); }
在上述程序中,pthread create函数表示
答案
创建线程,线程名为th_f
解析
pthread_create函数的作用是创建线程,包括有4个参数:第一个参数为指向线程标识符的指针;第2个参数用来设置线程属性;第3个参数是线程入口函数的起始地址。最后一个参数是线程入口函数的参数。一般以线程运行函数名命名线程名,但线程标识符指针在tid里,故本题答案应选择A选项。
【涉及考点】
第3章 进程线程模型
转载请注明出处。