Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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 <nacc@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Nishanth Aravamudan and committed by
Linus Torvalds
64ed93a2 672289e9

+16
+2
include/linux/sched.h
··· 203 203 204 204 #define MAX_SCHEDULE_TIMEOUT LONG_MAX 205 205 extern signed long FASTCALL(schedule_timeout(signed long timeout)); 206 + extern signed long schedule_timeout_interruptible(signed long timeout); 207 + extern signed long schedule_timeout_uninterruptible(signed long timeout); 206 208 asmlinkage void schedule(void); 207 209 208 210 struct namespace;
+14
kernel/timer.c
··· 1154 1154 1155 1155 EXPORT_SYMBOL(schedule_timeout); 1156 1156 1157 + signed long __sched schedule_timeout_interruptible(signed long timeout) 1158 + { 1159 + set_current_state(TASK_INTERRUPTIBLE); 1160 + return schedule_timeout(timeout); 1161 + } 1162 + EXPORT_SYMBOL(schedule_timeout_interruptible); 1163 + 1164 + signed long __sched schedule_timeout_uninterruptible(signed long timeout) 1165 + { 1166 + set_current_state(TASK_UNINTERRUPTIBLE); 1167 + return schedule_timeout(timeout); 1168 + } 1169 + EXPORT_SYMBOL(schedule_timeout_uninterruptible); 1170 + 1157 1171 /* Thread ID - the internal kernel "pid" */ 1158 1172 asmlinkage long sys_gettid(void) 1159 1173 {