On Thursday, 3. May 2001 17:39, Martin Diehl wrote:
> On Thu, 3 May 2001, Oliver Neukum wrote:
> > > - current state should be set to TASK_INTERRUPTIBLE for each loop
> > > traversing. schedule() always returns RUNNABLE, so we would only
> > > sleep once.
> >
> > How could the condition be true, once we are woken up ?
>
> Waiting on several events on the same waitqueue. For example, both
> lpusb_read() and lpusb_write() use lpusb->wait. So whenever an IN or OUT
> transfer gets completed _both_ wake up. So we have to loop and test again
> and sleep if it wasn't for us. Otherwise we would not even need a loop.
You are right. Subtle.
> > But there is a bug, pending signals are not check for after schedule, but
> > before.
>
> Oops - right. If loop is exited due to timeout or status!=EINPROGRESS we
> don't test for pending signals again. Test for pending signals could be
> placed after the loop with a simple break in the loop.
[..]
> ok, since we have the same test in the enclosing if-statement unprotected
> I think we should protect them both or none of it. At least for lpusb I
> don't see something brakes without - so I've dropped them.
> However I do prefer keeping the test for pending signals just before
> going to sleep so we can bail out until then. Missing test after loop
> exit added behind the loop.
Thinking more about it, I am not sure whether simply returning to user space
with pending signals is valid. Pending signals do _not_ imply that the urb
was not processed. IMHO you have to unlink the urb and check the result.
If you were early enough you return, if not you need to process the data
transfered.
Regards
Oliver
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
http://lists.sourceforge.net/lists/listinfo/linux-usb-devel