From: Nishanth Aravamudan Date: Sat, 10 Sep 2005 07:27:21 +0000 (-0700) Subject: [PATCH] add schedule_timeout_{,un}interruptible() interfaces X-Git-Tag: v2.6.14-rc1~157 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=64ed93a268bc18fa6f72f61420d0e0022c5e38d1;p=linux-2.6 [PATCH] add schedule_timeout_{,un}interruptible() interfaces Add schedule_timeout_{,un}interruptible() interfaces so that schedule_timeout() callers don't have to worry about forgetting to add the set_current_state() call beforehand. Signed-off-by: Nishanth Aravamudan Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/include/linux/sched.h b/include/linux/sched.h index ac70f845b5..4b83cb2300 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -203,6 +203,8 @@ extern int in_sched_functions(unsigned long addr); #define MAX_SCHEDULE_TIMEOUT LONG_MAX extern signed long FASTCALL(schedule_timeout(signed long timeout)); +extern signed long schedule_timeout_interruptible(signed long timeout); +extern signed long schedule_timeout_uninterruptible(signed long timeout); asmlinkage void schedule(void); struct namespace; diff --git a/kernel/timer.c b/kernel/timer.c index 13e2b513be..a0b716d627 100644 --- a/kernel/timer.c +++ b/kernel/timer.c @@ -1154,6 +1154,20 @@ fastcall signed long __sched schedule_timeout(signed long timeout) EXPORT_SYMBOL(schedule_timeout); +signed long __sched schedule_timeout_interruptible(signed long timeout) +{ + set_current_state(TASK_INTERRUPTIBLE); + return schedule_timeout(timeout); +} +EXPORT_SYMBOL(schedule_timeout_interruptible); + +signed long __sched schedule_timeout_uninterruptible(signed long timeout) +{ + set_current_state(TASK_UNINTERRUPTIBLE); + return schedule_timeout(timeout); +} +EXPORT_SYMBOL(schedule_timeout_uninterruptible); + /* Thread ID - the internal kernel "pid" */ asmlinkage long sys_gettid(void) {