kthread_run()
{
kthread_create();
wakeup_the_process();
}
kthread_create()
{
struct kthread_create_info create;
Wakeup(Kthreadd);
wait_for_completion(&create.done);//等待create_kthread()创建结束;
}
Kthreadd()
{
while(1){
schedule();
create_kthread();
}
}
create_kthread()
{
kernel_thread(kthread,create);
wait_for_completion(&create->started);等待kthread()运行起来;
complete(&create->done);//已经创建过程结束;
}
kthread()//这只是个外壳,Frame指的就是这个吧;
{
complete(&create->started);//kthread完全运行起来了;
schedule();//等待wakeup;
if (!kthread_should_stop())
ret = threadfn(data);
if (kthread_should_stop()) {
kthread_stop_info.err = ret;
complete(&kthread_stop_info.done);
}
}
阅读(2730) | 评论(0) | 转发(0) |