p*s
2 楼
使用pthread_create()出错,以下是测试用的代码:
void *ServerThread(void *arg1)
{
printf("I'm the server\n");
}
int main()
{
pthread_t serverID;
pthread_mutex_init(&lock, NULL);
printf("Now creating the thread to serve..\n");
if(pthread_create(&serverID, NULL, ServerThread, NULL)!=0)
perror("Could not create the thread\n");
pthread_join(serverID, NULL);
exit(0);
}
运行结果:
Now creating the thread to serve..
Could not create the thread
请问是为何出错?//bow
void *ServerThread(void *arg1)
{
printf("I'm the server\n");
}
int main()
{
pthread_t serverID;
pthread_mutex_init(&lock, NULL);
printf("Now creating the thread to serve..\n");
if(pthread_create(&serverID, NULL, ServerThread, NULL)!=0)
perror("Could not create the thread\n");
pthread_join(serverID, NULL);
exit(0);
}
运行结果:
Now creating the thread to serve..
Could not create the thread
请问是为何出错?//bow
c*i
3 楼
不看不是中国人
s*o
5 楼
楼主活腻了直说
相关阅读
what browser do you use?问个基本问题:term下怎么进入带空格的目录象My Doc?Poor Solaris perfomance.Linux 7.3下装ORACLE8.1.7新问题how to set include PATH如何在英文的UNIX下输入汉字???cygwinnetscape 莫名crashCan somebody recommend me good OS and Networking books?#pragma[转载] help! install cxterm in RH7.3, ld causes problems[转载] comparehelp!!!!!!!!!!!!!!!!!!!!Re: [转载] help! install cxterm in RH7.3, ld causes problemsRe: a question about lower IO[转载] CXTERM5.2的编译问题,LIBRARY如何设置?谢了先![转载] 看LINUX的源码,从哪里开始好?xemacs中怎么样设置自动回车对齐?where is libstdc++[转载] pop3 programming problem