#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
int a=10;
void* turn_back(void *num){
while(1){
printf("分支线程--> a=%d\n",a);
sleep(1);
}
}
int main(int argc, const char *argv[])
{
pthread_t pth=0;
if((pthread_create(&pth,NULL,turn_back,NULL))!=0){
fprintf(stderr,"pthread_create failed\n");
return -1;
}
while(1){
printf("主线程--> a=%d\n",a);
sleep(1);
}
return 0;
}