第1步:安装 Eclipse 开发环境
第2步:配置Eclipse 的ARM开发环境
第3步:新建一个过程,配置好环境
敲入下面的代码
#include <pthread.h>
#include <stdio.h>
#include <stddef.h>
#include <unistd.h>
#include <fcntl.h>
void *create(void *arg)
{
while(1)
{
printf("thread is Running ..... ");
sleep(5);
}
}
void *ReaderThread(void *arg)
{
while(1)
{
sleep(4);
printf("Read ID=\r\n");
}
}
int main(int argc, char *argv[])
{
pthread_t tidp;
int rc1,rc2;
rc1=pthread_create(&tidp,NULL,create,NULL);
if(rc1!=0)
{
printf("pthread_create is not created ... \r\n");
return -1;
}
printf("prthread_create is created... \r\n");
rc2=pthread_create(&tidp,NULL,ReaderThread,NULL);
if(rc2!=0)
{
printf("ReaderThread is not created ... \r\n");
return -1;
}
printf("ReaderThread is created... \r\n");
while(1)
{
printf("System is Runing...\r\n");
sleep(1);
}
return 0;
}
编译看看效果。