Linux内核线程的建立
来源:互联网 发布:淘宝开店需要押金吗 编辑:程序博客网 时间:2024/05/16 11:44
创建内核线程的函数:
thread = kthread_create(taskq_thread, tqt, "%s/%d", name, i);
wake_up_process(thread);
thread = kthread_create(taskq_thread, tqt, "%s/%d", name, i);
wake_up_process(thread);
其中taskq_thread为该内核函数需要做的事情。
所需要包含头文件
#include <linux/sched.h>
#include <linux/kthread.h>
#include <linux/err.h>
For Example:
resume complete时usb driver会调用do_rebind_interface() 来实现device的重新枚举。这会拖慢系统resume的速度,因此create一个线程来单独完成这件事情。
static int USBResumeSpeed_Improve(void *pvArg)// 函数返回值必须为int型{struct usb_device *udev = pvArg;do_rebind_interface(udev); return 0;}/* The device lock is held by the PM core */int usb_resume_complete(struct device *dev){struct usb_device *udev = to_usb_device(dev);int err;struct task_struct *ResumeThreadStruct; /* For PM complete calls, all we do is rebind interfaces * whose needs_binding flag is set */ if (udev->state != USB_STATE_NOTATTACHED){if(udev->descriptor.idProduce == 0x7662 ){char ResumeThreadName[10] = "RES_WIFI";ResumeThreadStruct = kthread_create(USBResumeSpeed_Improve, udev, ResumeThreadName);if(IS_ERR(ResumeThreadStruct)) {err = PTR_ERR(ResumeThreadStruct);ResumeThreadStruct = NULL;return err;}wake_up_process(ResumeThreadStruct);}else{ do_rebind_interfaces(udev);}}return 0;}
0 0
- Linux内核线程的建立
- linux内核树的建立
- linux内核树的建立
- linux内核树的建立
- linux内核树的建立
- linux内核线程的创建
- Linux 内核线程的使用
- linux内核根文件系统的建立过程
- linux 内核源码树的建立
- linux内核树的建立 (转)
- linux 内核源码树的建立
- Linux内核源码树的建立
- Linux内核源码树的建立
- Linux之内核源码树的建立
- 建立linux内核机制学习的模板
- Linux内核-内核线程
- 建立linux内核阅读器
- 建立UML(user mode linux)的linux内核调试环境
- [Erlang]如何使用NIF
- dojo中tree的使用教程(一)
- druid—tomcat配置使用(个人记录勿喷。。。)
- Xcode6的新特性、iPhone6和iPhone6Plus的适配,xcode6iphone6
- POJO模式
- Linux内核线程的建立
- cocos2d-x lua 使用自定义消息EventCustom
- 最长上升子序列(LIS),求长度并打印子序列
- RGB颜色值与十六进制颜色码转换工具
- NYOJ 891贪心
- java中的一些网络知识
- 47.隐式动画
- github出现HTTP request failed
- 详解SESSION与COOKIE的区别