android - Loading JNI libs- via Java threads or NDK pthreads? -
android - Loading JNI libs- via Java threads or NDK pthreads? -
i loading many .so libraries android application. when create jni call, function in library.so runs infinte loop, never returns calling function. should create jni phone call java thread or should fire function pthreads in library? better?
second question: how can sure libraries not running when user exits mainactivity? thanks.
for first question, alex said. should not create much of difference if take java or pthreads.
for sec question, should stash pointer created libraries in java code. easiest way jni phone call homecoming pointer jlong. since, jni function never returns, have straight set value in native code.
checkout implementation of nativehandle class here
http://thebreakfastpost.com/2012/01/26/wrapping-a-c-library-with-jni-part-2/
then before main activity exits (i presume in ondestroy() method) create phone call jni function stop libraries running
java android multithreading android-ndk jni
Comments
Post a Comment