All of lore.kernel.org
 help / color / mirror / Atom feed
* [Kernel-janitors] Add msleep_interruptible() function to
@ 2004-08-15 12:18 ` maximilian attems
  0 siblings, 0 replies; 12+ messages in thread
From: maximilian attems @ 2004-08-15 12:18 UTC (permalink / raw)
  To: linux-kernel; +Cc: kj

[-- Attachment #1: Type: text/plain, Size: 1339 bytes --]

while doing kernel-janitor msleep conversion of drivers own (incorrect),
functions, some places would need msleep_interruptible().

this function is equivalent to:
        current->state = TASK_INTERRUPTIBLE;
	schedule_timeout(timeout);

idea from Ingo Molnar:
well, aboves is not 100% equivalent because msleep() is uninterruptible so
stoppage of the md thread (upon shutdown) will occur with only a 250 msec
delay. Someone should add a msleep_interruptible() function to kernel/timer.c.

Signed-off-by: Maximilian Attems <janitor@sternwelten.at>


---

 linux-2.6.8-max/kernel/timer.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+)

diff -puN kernel/timer.c~add-msleep_interruptible kernel/timer.c
--- linux-2.6.8/kernel/timer.c~add-msleep_interruptible	2004-08-14 23:41:46.000000000 +0200
+++ linux-2.6.8-max/kernel/timer.c	2004-08-14 23:41:46.000000000 +0200
@@ -1503,3 +1503,18 @@ void msleep(unsigned int msecs)
 
 EXPORT_SYMBOL(msleep);
 
+/**
+ * msleep_interruptible - sleep waiting for waitqueue interruptions
+ * @msecs: Time in milliseconds to sleep for
+ */
+void msleep_interruptible(unsigned int msecs)
+{
+	unsigned long timeout = msecs_to_jiffies(msecs);
+
+	while (timeout) {
+		set_current_state(TASK_INTERRUPTIBLE);
+		timeout = schedule_timeout(timeout);
+	}
+}
+
+EXPORT_SYMBOL(msleep_interruptible);

_



[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2004-08-16 20:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-15 12:18 [Kernel-janitors] Add msleep_interruptible() function to maximilian attems
2004-08-15 12:18 ` Add msleep_interruptible() function to kernel/timer.c maximilian attems
2004-08-15 11:54 ` [Kernel-janitors] Re: Add msleep_interruptible() function to Alan Cox
2004-08-15 11:54   ` Add msleep_interruptible() function to kernel/timer.c Alan Cox
2004-08-15 13:25   ` [Kernel-janitors] Re: Add msleep_interruptible() function to maximilian attems
2004-08-15 13:25     ` Add msleep_interruptible() function to kernel/timer.c maximilian attems
2004-08-16  2:22     ` [Kernel-janitors] Re: Add msleep_interruptible() function to Ingo Molnar
2004-08-16  2:22       ` Add msleep_interruptible() function to kernel/timer.c Ingo Molnar
2004-08-16 20:00     ` [Kernel-janitors] Re: Add msleep_interruptible() function to Nishanth Aravamudan
2004-08-16 20:00       ` [Kernel-janitors] Re: Add msleep_interruptible() function to kernel/timer.c Nishanth Aravamudan
2004-08-15 12:50 ` [Kernel-janitors] Re: Add msleep_interruptible() function to Oliver Neukum
2004-08-15 12:50   ` Add msleep_interruptible() function to kernel/timer.c Oliver Neukum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.