summaryrefslogtreecommitdiff
blob: d7bd3bfa915c1e37605d173a64457c24f45460fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Patch frmo mainstream, merged by Pavel (xemul@):
Add msleep_interruptible() function to kernel/timer.c
This is a merge of three patches from janitor@ and Co:
http://linux.bkbits.net:8080/linux-2.6/gnupatch@4138ab70Qo9q3NhN2oCmPsvbtAlsUw
http://linux.bkbits.net:8080/linux-2.6/gnupatch@417c4a7cbEj-tPVGsHVgooPY1Bm0_g
http://linux.bkbits.net:8080/linux-2.6/gnupatch@41602673Fsjah1EZ1fphOKm3s59YCA

--- ./kernel/timer.c.msi	2005-10-20 13:33:52.000000000 +0400
+++ ./kernel/timer.c	2005-10-20 17:15:42.775194800 +0400
@@ -1526,3 +1526,19 @@ void msleep(unsigned int msecs)
 
 EXPORT_SYMBOL(msleep);
 
+/**
+ * msleep_interruptible - sleep waiting for signals
+ * @msecs: Time in milliseconds to sleep for
+ */
+unsigned long msleep_interruptible(unsigned int msecs)
+{
+	unsigned long timeout = msecs_to_jiffies(msecs) + 1;
+
+	while (timeout && !signal_pending(current)) {
+		__set_current_state(TASK_INTERRUPTIBLE);
+		timeout = schedule_timeout(timeout);
+	}
+	return jiffies_to_msecs(timeout);
+}
+
+EXPORT_SYMBOL(msleep_interruptible);
--- ./include/linux/delay.h.msi	2005-09-26 13:31:46.000000000 +0400
+++ ./include/linux/delay.h	2005-10-20 17:11:37.132538160 +0400
@@ -39,5 +39,6 @@ extern unsigned long loops_per_jiffy;
 #endif
 
 void msleep(unsigned int msecs);
+unsigned long msleep_interruptible(unsigned int msecs);
 
 #endif /* defined(_LINUX_DELAY_H) */