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 -;
  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, );
  17.  
  18. cyg_thread_resume(*thread_id);
  19.  
  20. return ;
  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 -;
  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 ;
  23. }

aa

linux 和 ecos 内核线程创建/信号量/event等对比的更多相关文章

  1. Linux内核线程创建

    本文旨在简单介绍一下Linux内核线程: 先举个例子: 不插U盘,在Linux命令行中输入:ps -el:然后插上U盘,再次输入:ps -el 会发现多出了下面一行(当然还会有其他的,比如scsi相关 ...

  2. linux c编程:线程创建

    前面章节中介绍了进程.从这一章开始介绍线程.进程和线程的差别是什么呢: 进程是具有一定独立功能的程序关于某个数据集合上的一次运行活动,进程是系统进行资源分配和调度的一个独立单位.  线程是进程的一个实 ...

  3. linux c学习笔记----线程创建与终止

    进程原语 线程原语 描述 fork pthread_create 创建新的控制流 exit pthread_exit 从现有的控制流中退出 waitpid pthread_join 从控制流中得到退出 ...

  4. linux系统编程:线程同步-信号量(semaphore)

    线程同步-信号量(semaphore) 生产者与消费者问题再思考 在实际生活中,仅仅要有商品.消费者就能够消费,这没问题. 但生产者的生产并非无限的.比如,仓库是有限的,原材料是有限的,生产指标受消费 ...

  5. Linux内核线程之深入浅出【转】

    转自:http://blog.csdn.net/yiyeguzhou100/article/details/53126626 [-] 线程和进程的差别 线程的分类 1     内核线程 2     轻 ...

  6. (转)Linux内核本身和进程的区别 内核线程、用户进程、用户线程

    转自:http://blog.csdn.net/adudurant/article/details/23135661 这个概念是很多人都混淆的了,我也是,刚开始无法理解OS时,把Linux内核也当做一 ...

  7. ucore lab4 内核线程管理 学习笔记

    越学越简单,真是越学越简单啊 看视频的时候着实被那复杂的函数调用图吓到了.看代码的时候发现条理还是很清晰的,远没有没想象的那么复杂. 这节创建了俩内核线程,然后运行第一个线程,再由第一个切换到第二个. ...

  8. linux内核中创建线程方法

    1.头文件 #include <linux/sched.h> //wake_up_process() #include <linux/kthread.h> //kthread_ ...

  9. linux内核中创建线程方法【转】

    本文转载自:https://www.cnblogs.com/Ph-one/p/6077787.html 1.头文件 #include <linux/sched.h> //wake_up_p ...

随机推荐

  1. AlwaysOn实现只读路由

    1.配置只读路由 ①配置A副本的只读路由属性(ReadOnly代表‘只读意向’) ALTER AVAILABILITY GROUP [testAG] MODIFY REPLICA ON N'WIN-1 ...

  2. SharePoint 学习记事(三)

    做一件事情,计划很重要,但是变化会将一切的付出付诸东流. 13年年底,领导想要调整资源,准备启动项目.于是我们召开了一个类似于启动会的资源筹备会.(处于低成本的考虑,部门领导想要共享日本组的两个做.n ...

  3. iOS9开发之新增通知行为详解

    苹果在iOS8发布时,收到短信时可以直接在通知栏输入文字并回复,非常炫酷,然而这一功能并未真正开放给开发者.iOS9新增了用户通知行为UIUserNotificationActionBehaviorT ...

  4. Xcode中,调试console窗口输出error: Couldn't materialize struct: the variable 'cell' has no location, it may have been optimized out的问题

    Xcode中调试代码时,常常需要使用console窗口查看变量的信息,比如使用了如下的命令来输出有关UITableView中一个UITableViewCell的信息, po cell 令人感到意外的是 ...

  5. C# ACM poj1008

    玛雅历 public static void Acm1008(int day, string mon, int year) { ; switch (mon) { case "pop" ...

  6. 4.MySQL连接并选择数据库(SQL & C)

    在连接了MySQL数据库之后,可以通过SQL命令或者C.PHP.JAVA等程序来指定需要操作的数据库.这里主要介绍SQL命令和相应的C程序. 首先创建用户rick(赋予所有权限) mysql> ...

  7. 使用Notepad++将多行数据合并成一行

    1.按Ctrl+F,弹出“替换”的窗口: 2.选择“替换”菜单: 3.“查找目标”内容输入为:\r\n: 4.“替换为”内容为空: 5.“查找模式”选择为正则表达式: 6.设置好之后,点击“全部替换” ...

  8. Python3 IO

    在磁盘上读写文件的功能都是由操作系统提供的,现代操作系统不允许普通的程序直接操作磁盘,所以,读写文件就是请求操作系统打开一个文件对象(通常称为文件描述符),然后,通过操作系统提供的接口从这个文件对象中 ...

  9. Javascript中setTimeout和setInterval的区别和使用

    在javascript中,window对象有两个主要的定时方法,分别是setTimeout 和 setInterval,其语法基本上相同,但是完成的功能取有区别. setTimeout方法是定时程序, ...

  10. 上传头像,界面无跳转,php+js

    上传头像,界面无跳转的方式很多,我用的是加个iframe那种.下面直接上代码. html: //route 为后端接口//upload/avatar 为上传的头像的保存地址//imgurl=/uplo ...