From: janitor@sternwelten.at Signed-off-by: Maximilian Attems Signed-off-by: Andrew Morton --- 25-akpm/include/linux/delay.h | 1 + 25-akpm/kernel/timer.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff -puN include/linux/delay.h~add-msleep_interruptible-function-to-kernel-timerc include/linux/delay.h --- 25/include/linux/delay.h~add-msleep_interruptible-function-to-kernel-timerc Wed Sep 1 15:41:27 2004 +++ 25-akpm/include/linux/delay.h Wed Sep 1 15:41:27 2004 @@ -39,6 +39,7 @@ extern unsigned long loops_per_jiffy; #endif void msleep(unsigned int msecs); +unsigned long msleep_interruptible(unsigned int msecs); static inline void ssleep(unsigned int seconds) { diff -puN kernel/timer.c~add-msleep_interruptible-function-to-kernel-timerc kernel/timer.c --- 25/kernel/timer.c~add-msleep_interruptible-function-to-kernel-timerc Wed Sep 1 15:41:27 2004 +++ 25-akpm/kernel/timer.c Wed Sep 1 15:41:27 2004 @@ -1514,3 +1514,19 @@ void msleep(unsigned int msecs) EXPORT_SYMBOL(msleep); +/** + * msleep_interruptible - sleep waiting for waitqueue interruptions + * @msecs: Time in milliseconds to sleep for + */ +unsigned long msleep_interruptible(unsigned int msecs) +{ + unsigned long timeout = msecs_to_jiffies(msecs); + + while (timeout && !signal_pending(current)) { + set_current_state(TASK_INTERRUPTIBLE); + timeout = schedule_timeout(timeout); + } + return jiffies_to_msecs(timeout); +} + +EXPORT_SYMBOL(msleep_interruptible); _