On Fri, 19 May 2006, Paul Giblock wrote:

> >        wait_for_completion(&(dev->read_comp) );
> >
> > What happens if the interrupt completes before you get here?  Hm, maybe
> > that will be safe, haven't looked at that in a long time, you might want
> > to verify this.
> 
> Good point, I guess I should check the status before doing a wait.  I
> figured that the completion would already be complete so
> wait_for_completion would return immediately.

This is safe.  Completions are a lot like the old semaphore 
implementation.  You can signal one before there are any waiters, and then 
the first waiter will complete immediately.

Furthermore, you can't check the status before waiting without a race.  
First because you can't check urb->status at all; drivers aren't allowed 
to look at it until the URB is complete.  Second, because even if you did 
check and found that it wasn't complete, it could still manage to complete 
before you called wait_for_completion.

Alan Stern



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to