
启动内核线程
由kthread_create()和wake_up_process()两部分组成,这样的好处是kthread_run()创建的线程可以直接运行。
create and wake a thread.
1 |
|
kthread_stop
结束指定线程,设置should_stop标志
1 |
int (struct task_struct *k); |
kthread_should_stop
返回should_stop标志,用于检查
1 |
int kthread_should_stop(void); |
例子
-
创建
1
2data->auto_update = kthread_run(adt7470_update_thread, client,
dev_name(data->hwmon_dev)); -
threadfn
1
2
3
4
5
6static int adt7470_update_thread(void *p)
{
while (!kthread_should_stop()) {
...
}
} -
stop
1
kthread_stop(data->auto_update);




近期评论