- 论坛徽章:
- 0
|
本帖最后由 EZWORD 于 2011-01-10 20:11 编辑
神马啊,设置完了状态,又没有移出运行队列,除非掉用那个schedule_timeout,其代码如下:
- signed long schedule_timeout(signed long timeout)
- {
- timer_t timer;
- unsigned long expire;
- switch (timeout)
- {
- case MAX_SCHEDULE_TIMEOUT:
- schedule();//此处必须自己去唤醒这个任务。
- goto out;
- default:
- if (timeout < 0)
- {
- printk(KERN_ERR “schedule_timeout: wrong timeout “
- “value %lx from %p\n”, timeout,
- __builtin_return_address(0));
- current->state = TASK_RUNNING;
- goto out;
- }
- }
- expire = timeout + jiffies;
- init_timer(&timer);
- timer.expires = expire;
- timer.data = (unsigned long) current;
- timer.function = process_timeout;
- add_timer(&timer);
- schedule();//再次调度时返回位置
- del_timer_sync(&timer);
- timeout = expire - jiffies;
- out:
- return timeout < 0 ? 0 : timeout;
- }
复制代码 |
|