做图形界面,想用多线程做后台数据处理,只需可以创建一个新线程,执行一函数即可,下面是采用了一种C下的方法,在C++下编译总是出错,请问在C++下该怎么改
void thread(void)
{
printf ("The child process...\n");
}
int main(int argc, char *argv[])
{
pthread_t id;
int i,ret;
ret=pthread_create(&id,NULL,(void *)thread(),NULL);
if(ret!=0)
{
printf ("Create pthread error!\n");
exit (1);
}
}