void *thread1(v.oid).
{
printf("thread1 : I`m thread 1 .\n").;[成人用品]
for (i=0; i<MAX; i++.).服务器
{
. .printf("thread1 : before global share number = %d \n",number).; 美容
. . printf("thread1 : locking...\n"); 健康
. pthread_mutex_lock(&mut); // .上锁 汽车
s.leep(1);.
numb.er++;.
. pthread_mutex_unlock(&mut).; // 解锁.
print.f("thread 1 is unlocked!\n.");( 游戏 )
. .printf("thread 1. : after global share number = %d \n",number);[成人用品]
}
. printf("pthread 1 wi.ll exit...\n"); 鲜花
pthread.._exit(NULL);--------------彩票
}
。。。。。
memset(&thread,0,sizeof(thread)); . . . (广告)
if((tmp = pthread_create(&thread[0],N.ULL,(void *)thread1.,N.ULL)) != 0) 学习
{ . . . .
. . printf(" pthread 1 creating fai.led!\n"); 学习
} . . . 电子
e.lse . . 虚拟主机
. { . . 外贸
printf(" pthread 1 crea.ting successfully!\n"); . . ( 游戏 )
. } 外汇
。。。。。
if (thread[0] != 0) . . . .
.{ . . [成人用品]
pthread_join(thread[0],NULL); // 等待线程结束 . . . 健康
printf("thread 1 comp.letion!\n"); . . 鲜花
}