main()主程序里创建一个新线程:
(void*) thread2;
pthread_t id2;
main(){
ret=pthread_create(&id,NULL,(void*) thread,NULL);
if (ret!=0)
{
printf("Create pthread error!\n");
exit (1);
}
//第二个线程
ret=pthread_create(&id2,NULL,(void*) thread2,NULL);
if (ret!=0)
{
printf("Create pthread2 error!\n");
exit (1);