当前位置:Linux教程 - Linux文化 - schedule_timeout问题

schedule_timeout问题


>>> 此贴的回复 >> 你是不是想说, 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 不敢保证,随时可能被信号唤醒.