#include <stdio.h>
#include <unistd.h>
#include <pthread.h> //步骤1:引入头文件
//步骤2:写一个线程函数 void *函数名(void *arg)
void *fun1(void *arg){
//步骤3: 实现功能
int j = 0;
while(1)
{
printf("j=%d\n", j);
sleep(1);
}
}
int main(){
//步骤4:线程号
pthread_t t1;
//步骤5:开启线程
pthread_create(&t1,NULL,fun1,NULL);
int i = 0;
while(1)
{
printf("i=%d\n", i);
sleep(1);
}
return 0;
}