- 論壇徽章:
- 0
|
本帖最后由 EZWORD 于 2011-01-10 20:11 編輯
神馬啊,設置完了狀態(tài),又沒有移出運行隊列,除非掉用那個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;
- }
復制代碼 |
|