diff options
author | Greg Kroah-Hartman <greg@kroah.com> | 2004-05-18 01:49:36 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <greg@kroah.com> | 2004-05-18 01:49:36 -0700 |
commit | 8365c315507fe10925bb3281d74444fe02935b25 (patch) | |
tree | d0ac9a8256cd0c889e226dde07d828723eda305a /kernel | |
parent | b80345b7d08708cf7b14cd9c1f2b310a4a31aa86 (diff) | |
download | history-8365c315507fe10925bb3281d74444fe02935b25.tar.gz |
Add msleep function to the kernel core to prevent duplication.
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/timer.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/kernel/timer.c b/kernel/timer.c index d28aecec0be120..0f2d571dff3a1c 100644 --- a/kernel/timer.c +++ b/kernel/timer.c @@ -1485,3 +1485,20 @@ unregister_time_interpolator(struct time_interpolator *ti) spin_unlock(&time_interpolator_lock); } #endif /* CONFIG_TIME_INTERPOLATION */ + +/** + * msleep - sleep safely even with waitqueue interruptions + * @msecs: Time in milliseconds to sleep for + */ +void msleep(unsigned int msecs) +{ + unsigned long timeout = msecs_to_jiffies(msecs); + + while (timeout) { + set_current_state(TASK_UNINTERRUPTIBLE); + timeout = schedule_timeout(timeout); + } +} + +EXPORT_SYMBOL(msleep); + |