Re: Question about hub_thread

Alan Stern <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
On Fri, 10 Aug 2007, jidong xiao wrote:

> Here are the piece of code from 2.6.22.1,
> 
>    2817 static int hub_thread(void *__unused)
>    2818 {
>    2819         do {
>    2820                 hub_events();
>    2821                 wait_event_interruptible(khubd_wait,
>    2822                                 !list_empty(&hub_event_list) ||
>    2823                                 kthread_should_stop());
>    2824                 try_to_freeze();
>    2825         } while (!kthread_should_stop() ||
> !list_empty(&hub_event_list))        ;
>    2826
>    2827         pr_debug("%s: khubd exiting\n", usbcore_name);
>    2828         return 0;
>    2829 }
> 
> I have a question.
> 
> try_to_freeze should be the only way for this thread to go suspended.
> 
> If we have already gone sleeping via wait_event_interruptible(), then
> if there is signal to wakeup this thread and ask it to go to
> suspended,then wait_event_interruptible will return and
> try_to_freeze() will be invoked and hence this thread will go into
> refrigerator.
> 
> But if we are still running inside hub_events(),then if we received
> any signal, what will happen?still try_to_freeze will be executed?why?

Nothing will happen.  The thread will continue to run inside 
hub_events() and it won't freeze until hub_events() returns.

Alan Stern


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.