NDK multithread JNI

  • 443
  • 0

摘要:NDK multithread JNI

JNI in multithread

=================================================================================

first call  AttachCurrentThread

int res = cGameApp::m_spANativeActivity->vm->AttachCurrentThread(&g_pMultiThreadEnv,NULL);

 

then use JNI method and befor leave thread must call

cGameApp::m_spANativeActivity->vm->DetachCurrentThread();

 

or it will show thread Deatch not call yet

=================================================================================

any GetObjectClass or NewRef is called must call Env->DeleteLocalRef(ooxx);

or it will show reached maximum JNI referance 512