On Mon, 13 Dec 2004, Oliver Neukum wrote: > Am Montag, 13. Dezember 2004 09:56 schrieb li xinyi: > > Hi, all > > > > In usb.c (kernel 2.4.20, I have to work on this kernel version), > > > > function usb_start_wait_urb() sets the process state to > > TASK_UNINTERRUPTIBLE and add the process to awd.wqh before calling > > usb_submit_urb(). What is this for? > > > > And What if scheduling happens during the usb_submit_urb() but before > > it calls urb->complete to wake the process? A TASK_UNINTERRUPTIBLE > > process wont have chance to run, right? Isnt this a deadlock? (please > > correct me if I am wrong). > > This is kernel code. It won't schedule unless it blocks. The preempt code > will also handle this case.
And to answer the first part of your question, the state is set and the process is added to awd.wqh so that it can sleep during the "while (timeout && !awd.done)" loop. Since schedule_timeout doesn't change the process state, it will return immediately if the state isn't set beforehand to TASK_INTERRUPTIBLE or TASK_UNINTERRUPTIBLE. Alan Stern ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/ _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel