Welcome 微信登录

首页 / 操作系统 / Linux / 在Ubuntu下用Eclipse开发ARM多线程程序

第1步:安装 Eclipse 开发环境 http://www.linuxidc.com/Linux/2012-02/53964.htm第2步:配置Eclipse 的ARM开发环境 http://www.linuxidc.com/Linux/2012-02/54007.htm第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= ");
    }
}

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 ... ");
            return -1;
     }

     printf("prthread_create is created... ");
     rc2=pthread_create(&tidp,NULL,ReaderThread,NULL);
     if(rc2!=0)
     {
            printf("ReaderThread is not created ... ");
            return -1;
     }

     printf("ReaderThread is created... ");
     while(1)
     {
         printf("System is Runing... ");
         sleep(1);
     }
    return 0;
}编译看看效果。
  • 1
  • 2
  • 下一页
Ubuntu下Eclipse搭建ARM开发环境Vim代码颜色配置-PHP版相关资讯      Eclipse  arm  Ubuntu安装教程 
  • ARM学习篇 SDRAM理解  (今 07:41)
  • Eclipse中将Java项目转换成Web项目  (07月28日)
  • 关于ARM ,你不得不知道的5件事!  (07月20日)
  • 平板电脑安装Ubuntu教程  (09月26日)
  • 移动芯片ARM创始人:ARM归属日本是  (07月21日)
  • Linux 下搭建stm32开发环境   (07月01日)
本文评论 查看全部评论 (0)
表情: 姓名: 字数