On Wed, Sep 15, 2004 at 03:40:36PM -0400, Alan Stern wrote:
> On Wed, 15 Sep 2004, Nishanth Aravamudan wrote:
> 
> > Oliver,
> > 
> > It was recommended to me to ask you a question about the proper ordering
> > of add_wait_queue() and set_current_state().
> > 
> > In some drivers the order is
> > 
> > set_current_state(TASK_INTERRUPTIBLE);
> > add_wait_queue(...);
> > 
> > and in others it is
> > 
> > add_wait_queue(...);
> > set_current_state(TASK_INTERRUPTIBLE);
> > 
> > It seems like one of these should be oorrect and not the other, but I'm
> > not sure which is which. Any insight you could provide would be greatly
> > appreciated.
> > 
> > -Nish
> 
> Why not simply use wait_event_interruptible()?

I'm not too familiar with the USB code, so I'm not sure if such a change
is possible in all cases. It may help if I give an example of what I was
referring to:

drivers/usb/misc/auerswald.c::auerchain_start_wait_urb()

as it is right now:

set_current_state (TASK_INTERRUPTIBLE);  /* I changed this */
add_wait_queue (&chs.wqh, &wait);

---some other stuff---

while (timeout && !chs.done)
{
        set_current_state(TASK_INTERRUPTIBLE); /* I change this & the
                                                        order */
        timeout = schedule_timeout (timeout);
        rmb();
}

How would I go about making the change as you suggested (if it's
possible here?). Feel free to take your response off-list or to just
point me to a URL/doc.

Thanks,
Nish


-------------------------------------------------------
This SF.Net email is sponsored by: thawte's Crypto Challenge Vl
Crack the code and win a Sony DCRHC40 MiniDV Digital Handycam
Camcorder. More prizes in the weekly Lunch Hour Challenge.
Sign up NOW http://ad.doubleclick.net/clk;10740251;10262165;m
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to