Commit 52842ed7 authored by Maximilian Attems's avatar Maximilian Attems Committed by Linus Torvalds

[PATCH] Add msleep_interruptible() function to kernel/timer.c

Signed-off-by: default avatarMaximilian Attems <janitor@sternwelten.at>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent b3cd39c1
......@@ -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)
{
......
......@@ -1507,3 +1507,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);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment