Hi,

     I'm implementing a service that contains a thread to handle all
time consuming operation. My core service logic is in a different
thread than the ui or main thread. According to the Android document,
when the OS plans to free some system resource, it will call onDestroy
() on the service and only when onDestroy() returns it will kill the
process hosting the service, thus giving opportunity to the service to
cleanup.

     Now, when onDestroy() is called, I want to send a message to my
service thread to do the necessary cleanup. Only when the service
thread acknowledges that the cleanup or shutdown is complete, onDestroy
() should return.
I could find a way to send asynchronous messages to threads and the
corresponding processing of the messages, but not able to figure out
how I need to implement onDestroy(), such that it would send a message
to the service thread and should wait for a result, before returning.

    Appreciate if someone can comment on my understanding of onDestroy
() and provide some solution to the above problem.

Thanks and Regards,
Gautam.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to