Hi,
I have written an application which calls native methods through JNI.
In the native library 4 threads are started.
On USB removal, the application is to be closed including the native
threads.
Upon receiving the USB removal event, we are trying to kill the
threads (pthread_kill() ) and then finish (using finish()) the
activity.
After reconnecting the USB, the application is not launching due to
memory corruption.
In DDMS, it shows the threads are still attached to bionic.
As the threads are not closed, I feel the resources were not released
properly.
If I reconnect again then application launches and works fine and the
same repeats on every launch.

To solve this problem
Can I use System.gc() ?
Can I use pthread_exit() 1st and then pthread_join instead of
pthread_kill ?
Whats the procedure in Android to kill the native threads and also the
application ?
After the application is closed, will it not be listed in DDMS ?

Regards,
Bhargavi

-- 
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

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words "REMOVE ME" as the subject.

Reply via email to