New HP Slate Photos here ----> Website with photos<http://bizoppoffer.com/x/0/1320/6428/>
On Tue, Apr 20, 2010 at 3:24 PM, Mark Murphy <[email protected]>wrote: > Nathan wrote: > > On Apr 20, 2:11 pm, Dianne Hackborn <[email protected]> wrote: > >> Killing threads is horribly bad and not something anyone should do. You > >> need to check in your task if it has been canceled, and return if so. > >> > > > > I don't necessarily disagree. But that is what the documentation says > > it does. So someone who wrote the documentation thought killing > > threads was fine and the person who implemented it thought differently > > and ignored the parameter? They should probably talk. > > I am fairly certain the person who wrote the documentation and who wrote > the class is the same person, and I'm not aware that he suffers from > multiple personality disorder. :-) > > The documentation, as you quoted earlier, says: > > "If the task has already started, then the mayInterruptIfRunning > parameter determines whether the thread executing this task should be > interrupted in an attempt to stop the task." > > That does not imply, however, that the thread is interruptible. That's a > Java thing, not an AsyncTask thing. > > I'm with Ms. Hackborn on this one -- I avoid designs that require Java > threads to be stopped. > > > When Android kills the service, which it can do at any time without > > warning, does it kill the Async threads? > > If by "kills the service" you mean "destroys the service", then no, I'm > reasonably certain the threads are not killed. The AsyncTask will run to > completion regardless of the status of the component that started is. > Leastways, I'm rather sure this is what happens with activities, and I'm > not aware of any differences with respect to services in this regard. > AsyncTask maintains a thread pool, so even when the task is complete, > the thread does not necessarily terminate. > > If by "kills the service" you mean "terminates the process", then yes, > the thread will go away when the process goes away. > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com | http://twitter.com/commonsguy > > Android Training...At Your Office: http://commonsware.com/training > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

