#include
#include
#include
#include
int num;
void pp()
{
int i=0;
for(i=0;i<10;i++){
printf("child threadread read:num=%d\n", num);
sleep(1);
}
}
void main(int argc, char **argv[])
{
unsigned int ptid;
num=0;
pthread_create(&ptid, NULL, (void *)pp, NULL);
for(num=0;num<10;num++) {
printf("now is parent thread,num=%d\n", num);
sleep(1);
}
pthread_join(ptid,NULL);
exit(0);
}
阅读(608) | 评论(0) | 转发(0) |