Does Looper.quit interrupt a sleeping Thread?

Put your problem here if it does not fit any of the other categories.

Does Looper.quit interrupt a sleeping Thread?

Postby ExxKA » Wed Dec 02, 2009 11:29 pm

I am implementing a background thread by using the Looper construct suggested in the Looper API. Sun has deprecated the method Thread.stop, so instead I am using the method Looper.quit(), The API says nothing about this method but it works.

I have only one question, and for the answer I guess we must rely on experience, unless the google team is reading this post.

Does the method Looper.quit, interrupt a Thread?
How does it handle a sleeping Thread?
Is the Looper implemented using busy waiting, and how does Thread.sleep() affect the Looper?
Student at the IT-University of Copenhagen
Visit my blog 1337h4x0r.com
ExxKA
Developer
Developer
 
Posts: 29
Joined: Tue Nov 03, 2009 7:16 pm
Location: Denmark

Top

Postby hardcoras » Thu Dec 03, 2009 2:00 am

You can always look at the source code to understand what happens under the hood:
http://android.git.kernel.org/?p=platform/frameworks/base.git;a=tree;f=core/java/android/os;h=5e558ea09f01d3089d2f008987e68b3e61ea82ce;hb=dde8b50b87fdb6849428fff7808e060489b31142

From the first glance there is no call on interrupt() method. Only notify() call to wake up one thread waiting for a MessageQueue object monitor to acquire (check MessageQueue.enqueueMessage()).

Maybe i'm missing something, because i don't use Looper myself.

But anyway, the best way to understand how everything works is to dig in into the source code.
hardcoras
Experienced Developer
Experienced Developer
 
Posts: 62
Joined: Sat Nov 14, 2009 2:31 pm
Location: Lithunia

Postby ExxKA » Thu Dec 03, 2009 6:44 pm

hardcoras wrote:But anyway, the best way to understand how everything works is to dig in into the source code.


Thanks, i didn't know where to find the sourcecode.

Still, If anyone has any hands on experience, please let me know.
Student at the IT-University of Copenhagen
Visit my blog 1337h4x0r.com
ExxKA
Developer
Developer
 
Posts: 29
Joined: Tue Nov 03, 2009 7:16 pm
Location: Denmark

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot] and 13 guests