歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> Linux資訊 >> Linux文化 >> schedule_timeout問題

schedule_timeout問題

日期:2017/2/27 12:09:12   编辑:Linux文化

>>> 此貼的回復 >> 你是不是想說, set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout(((1BlockEraseTimeoutTyp) * HZ) / 1000); 頭2句對timeout有什麼影響吧?

第一句,進程可以被消息喚醒。第2句,進程不能被消息喚醒。 詳細請參考《linux內核源代碼情景分析》上冊有關進程調度和進程間通信的章節。

>>> 此貼的回復 >> 注釋裡就有啊,

1100 * %TASK_UNINTERRUPTIBLE - at least @timeout jiffies are guaranteed to 1101 * pass before the routine returns. The routine will return 0 1102 * 1103 * %TASK_INTERRUPTIBLE - the routine may return early if a signal is 1104 * delivered to the current task. In this case the remaining time 1105 * in jiffies will be returned, or 0 if the timer expired in time

TASK_UNINTERRUPTIBLE 可以保證充足的睡眠時間, TASK_INTERRUPTIBLE 不敢保證,隨時可能被信號喚醒.


Copyright © Linux教程網 All Rights Reserved