[31][10][单选]对于如下 C 语言程序
void *th_pg(void *arg)
{
printf("Hello World");
pthread_exit(0);
}
int main(void)
{
pthread_t ptid;
int sta, stb;
sta = pthread_create(&ptid, NULL, th_pg1, NULL);
if (sta == 0)
printf("Oops, I can not create thread1\n");
stb = pthread_create(&ptid, NULL, th_pg2, NULL);
if (stb == 0)
printf("Oops, I can not create thread2\n");
exit(NULL);
}在上述程序中,pthread create函数表示
创建线程,线程名为 bid
创建线程,线程名为 sta和stb
创建线程,线程名为 th_pg1 和 th_pg2
创建线程,线程名为 NULL
答案
创建线程,线程名为 th_pg1 和 th_pg2
解析
pthread_create 表示创建一个新线程。根据上述程序,pthread_create 函数表示创建线程,线程名为 th_pg1 和 th_pg2。涉及考点为第 2 章进程管理。
转载请注明出处。
