How to stop a blocked handler thread?

622 Views Asked by At

I have bind an activity to a remote service through aidl interface. Various other activities are also bound to it. After some point of time, calls are getting blocked. When I open that particular activity it starts a handlerthread and it is calling some remote methods through aidl interface. But they are blocked so thread is also getting blocked. Inside onDestroy() method, I am trying to do handlerthread.quit(), but thread is not stopping. So every time I am starting that activity threads are started but not getting stopped on destroying activity.

My question is how can I stop the handlerthread which is in blocked state?

1

There are 1 best solutions below

1
On

your aidl interfaces might be bidirectional. try making them oneway which will make them non-blocking.

Also, if your requirement is not to make them onway, check this link there it explains how to stop a handler thread.