On Tue, May 18, 2004 at 12:30:06PM -0400, Jeff Garzik wrote:
> 
> Your attached patch needs to be generic, just like the recent 
> msecs_to_jiffies() stuff...
> 
> I call this function "msleep" in my code, though your implementation is 
> better (msleep is still a better name, though :))

Ok, does this look acceptable to everyone?

thanks,

greg k-h

--- a/include/linux/time.h      Sat May 15 04:50:38 2004
+++ b/include/linux/time.h      Tue May 18 10:15:47 2004
@@ -205,6 +205,20 @@
 #endif
 }
 
+/**
+ * msleep - sleep safely even with waitqueue interruptions
+ * msecs: Time in milliseconds to sleep for
+ */
+static inline void msleep(unsigned int msecs)
+{
+       unsigned long timeout = msecs_to_jiffies(msecs);
+
+       while (timeout) {
+               set_current_state(TASK_UNINTERRUPTIBLE);
+               timeout = schedule_timeout(timeout);
+       }
+}
+
 /*
  * The TICK_NSEC - 1 rounds up the value to the next resolution.  Note
  * that a remainder subtract here would not do the right thing as the


-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband
Sign-up now for SourceForge Broadband and get the fastest
6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to