首页 > 代码库 > linux 和 ecos 内核线程创建/信号量/event等对比
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\n",__func__,task);15 16 *thread_id = (unsigned int)task;17 18 GXAV_DBG("%s(),thread_id : 0x%x\n",__func__,*thread_id);19 20 wake_up_process(task);21 22 return 0;23 }
aa
linux 和 ecos 内核线程创建/信号量/event等对比
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。