i have private lib developed company. allowed me set callback function, after long time operation completes, callback called in sub thread.
i should operate jvm in callback. main code in call function:
jnienv *penv = null; gljnicontext.pjvm->attachcurrentthread(&penv, null); uiinkeymsinternal(penv, 10000000); gljnicontext.pjvm->detachcurrentthread();
the attachcurrentthread
attach sub thread jvm, uiinkeymsinternal
call java method, , detachcurrentthread
detach sub thread jvm, , gljnicontext.pjvm
stored in native method method this:
javavm* gs_jvm; penv->getjavavm(&gs_jvm); gljnicontext.pjvm = gs_jvm;
with line gljnicontext.pjvm->detachcurrentthread();
, program crash. without line, it's normal. how analyse phenomenon?
another question, can jnienv variable attachcurrentthread
method normally, findclass
method doesn't execute normally. whatever pass, "java/lang/thread", return 0x00. normal or can ignore it?
don't call jni handler function
main thread
. calling jni handler function
main thread make crash.
Comments
Post a Comment