On Tue, 11 May 2004, Oliver Neukum wrote:
> Hi Greg, hi list,
>
> quoting Linus:
>
> --
> > so there is no need to recheck the bit in do/while loop, because
> > there is no false wakeups now.
>
> You should never assume this. You should assume that there are _always_
> false wakeups.
>
> Why? Because Linux has always allowed people to leave wait-queues active,
> without being "atomic". For example, the tty read/write layer used to
> (still does?) add itself on the wait-queue _once_, and then leave itself
> on the wait-queue while in a loop it does copies from/to user space.
> --
>
> Unfortunately, this means us. Here's the first fix. Comments?
There are plenty of other places in the USB code that could use this sort
of cleanup. How about defining and exporting a utility routine in usb.c
for this purpose? Something like
usb_sleep_ms(unsigned int ms, int sleep_state);
where sleep_state could be TASK_INTERRUPTIBLE or
TASK_UNINTERRUPTIBLE
or
usb_sleep_ms_interruptible(unsigned int ms);
usb_sleep_ms_uninterruptible(unsigned int ms);
which would handle the conversion to jiffies, setting the task state, and
the repeated calls to schedule_timeout().
Alan Stern
-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to
deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel