zoukankan      html  css  js  c++  java
  • linux 和 ecos 内核线程创建/信号量/event等对比

    ecos:

     1 int gx_thread_create (const char *thread_name, gx_thread_id *thread_id,
     2         void(*entry_func)(void *), void *arg,
     3         void *stack_base,
     4         unsigned int stack_size,
     5         unsigned int priority,
     6         gx_thread_info *thread_info)
     7 {
     8 #define GX_THREAD_PRIORITY_MAX  255
     9 
    10     if (priority > GX_THREAD_PRIORITY_MAX || thread_id == NULL 
    11             || entry_func == NULL || thread_name == NULL 
    12             || stack_base == NULL || thread_info == NULL)
    13         return -1; 
    14 
    15     cyg_thread_create_ex((cyg_addrword_t)priority, (cyg_thread_entry_t *)entry_func, (cyg_addrword_t)arg,
    16             (char *)thread_name, stack_base, (cyg_ucount32)stack_size, thread_id, thread_info, 0); 
    17 
    18     cyg_thread_resume(*thread_id);
    19 
    20     return 0;
    21 }

     linux:

     1 int gx_thread_create (const char *thread_name, gx_thread_id *thread_id,
     2         void(*entry_func)(void *), void *arg,
     3         void *stack_base,
     4         unsigned int stack_size,
     5         unsigned int priority,
     6         gx_thread_info *thread_info)
     7 {
     8     struct task_struct *task = NULL;
     9 
    10     task = kthread_create((int (*)(void *))entry_func, arg, "%s",thread_name);
    11     if(task == NULL)
    12         return -1; 
    13 
    14     GXAV_DBG("%s(),task : %p
    ",__func__,task);
    15 
    16     *thread_id = (unsigned int)task;
    17 
    18     GXAV_DBG("%s(),thread_id : 0x%x
    ",__func__,*thread_id);
    19 
    20     wake_up_process(task);
    21 
    22     return 0;
    23 }

    aa

  • 相关阅读:
    vue路由学习
    vue组件学习
    Vue常用特性
    Vue入门常用指令
    ES6新增语法
    如何搭建一个vue项目(完整步骤)
    OA办公系统
    java有序数组的有序交集
    javascript输出数据到文件
    node js 实现文件上传与反显
  • 原文地址:https://www.cnblogs.com/jingzhishen/p/4189166.html
Copyright © 2011-2022 走看看