1 Star 0 Fork 1

qingsonggege / openwrt_mt7688_ctest

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
threadtest.c 588 Bytes
一键复制 编辑 原始数据 按行查看 历史
Midas 提交于 2016-12-04 08:37 . first commit,put all files to git
#include <stdio.h>
#include <pthread.h>
#include <stdlib.h> // for exit()
#define Thread_Num 10
void thread()
{
int i;
for(i=0;i<5;i++)
{
printf("This is from thread: %d \n",i);
usleep(1000);
}
}
int main()
{
pthread_t id[Thread_Num];
int j,i,ret;
for(j=0;j<Thread_Num;j++)
ret=pthread_create(&id[j],NULL,(void *)thread,NULL);
if(ret!=0)
{
printf("Create thread error!\n");
exit(1);
}
for(i=0;i<5;i++)
{
printf("This is from main: %d \n",i);
usleep(1000);
}
for(j=0;j<Thread_Num;j++)
pthread_join(id[j],NULL);
return(0);
}
1
https://gitee.com/qingsonggege/openwrt_mt7688_ctest.git
git@gitee.com:qingsonggege/openwrt_mt7688_ctest.git
qingsonggege
openwrt_mt7688_ctest
openwrt_mt7688_ctest
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891