detaching thread with interp frames (count=2)
来源:互联网 发布:厦大网络继续教育学院 编辑:程序博客网 时间:2024/06/14 19:37
Because the callback happens on some native thread, different from the VM thread which loads the library. The JNI implementation maintains a JNIEnvper thread, and puts the pointer in thread-local storage. It is only initialized for native threads which are attached to the VM. You need to call AttachCurrentThread()(or more probably AttachCurrentThreadAsDaemon()) inside the callback to get a JNIEnvpointer valid for that thread. This attaches the thread to the VM on the first call and is a nop thereafter.
android的每个应用程序对应一个虚拟机。所以每个应用程序会有一个jvm,也就是jvm是应用程序范围内的。而jenv却是线程范围内的,每个线程一个。native线程而只有native线程函数需要attach。所以我们在本地调用时要先用getenv查询线程是否拥有jenv,如果拥有则不需要attach,否则需要attach。
bool myAttachCurrentThread(void** env ){ int status = 0; status = gs_jvm->GetEnv(env,JNI_VERSION_1_4); if(status<0) { gs_jvm->AttachCurrentThread((JNIEnv**)env, NULL); return true; } return false;}
0 0
- detaching thread with interp frames (count=2)
- native thread exited without detaching
- jni 线程函数调用技巧-native thread exited without detaching
- Frames not available for unsuspended thread
- frames
- Frames
- Detaching Threads
- iPhone Read UIimage (frames) from video with AVFoundation
- Monitoring with Thread
- qt thread with movetothread
- Thread with Looper
- Skipped 60 frames! The application may be doing too much work on its main thread
- Count Numbers with Unique Digits
- Count Numbers with Unique Digits
- Count Numbers with Unique Digits
- Count Numbers with Unique Digits
- Count Numbers with Unique Digits
- Count Numbers with Unique Digits
- SSO(单点登录)实施中遇到的几个问题
- Android项目收集
- S3C2440重新编译内核及移植QT4.7.3
- leetcode- Surrounded Regions
- MySQL数据库的初始化mysql_install_db
- detaching thread with interp frames (count=2)
- linux VFS中dentry结构解析
- tomcat发布路径配置
- 数据库复习
- class文件格式
- Vision引擎中材质着色器介绍
- psotgis shapefile and dbf 插件安装
- Xml CDATA 序列化
- vector和list区别【转】