c语言 pthread.h 头文件

Modified on: Tue, 01 Jan 2019 22:02:00 +0800 热度: 4,116 度

注意:此头文件仅限Linux相关的系统使用

#include "stdio.h"
#include "stdlib.h"
#include "pthread.h"

void* myfuc(void* args)
{

int i;
for(i=0;i<50;i++)
{
    printf("%d\n",i);
}
return NULL;

}

int main()
{

pthread_t th1;
pthread_t th2;

pthread_create(&th1,NULL,myfuc,NULL);
pthread_create(&th2,NULL,myfuc,NULL);

pthread_join(th1,NULL);
pthread_join(th2,NULL);
return 0;

}

添加新评论