Go to the documentation of this file.
38 CAkJNIThread(JavaVM* jvm) : m_jvm(jvm), m_jEnv(
NULL), m_mustDetachExplicitely(false), m_mustPopLocalFrame(false)
43 CAkJNIThread(JavaVM* jvm,
int numLocalRefs) : m_jvm(jvm), m_jEnv(
NULL), m_mustDetachExplicitely(false), m_mustPopLocalFrame(false)
45 AcquireEnv(jvm, numLocalRefs);
50 if (m_mustPopLocalFrame)
52 m_jEnv->PopLocalFrame(
NULL);
53 m_mustPopLocalFrame =
false;
55 if (m_jvm !=
NULL && m_jEnv !=
NULL && m_mustDetachExplicitely)
57 m_jvm->DetachCurrentThread();
58 m_mustDetachExplicitely =
false;
69 return m_jEnv !=
NULL;
73 void AcquireEnv(JavaVM* jvm,
int numLocalRefs)
78 jvm->GetEnv((
void**)&m_jEnv, JNI_VERSION_1_6);
81 JavaVMAttachArgs lJavaVMAttachArgs;
82 lJavaVMAttachArgs.version = JNI_VERSION_1_6;
83 lJavaVMAttachArgs.name =
"NativeThread";
84 lJavaVMAttachArgs.group =
NULL;
86 jvm->AttachCurrentThread(&m_jEnv, &lJavaVMAttachArgs);
87 m_mustDetachExplicitely =
true;
89 if (m_jEnv && numLocalRefs > 0)
91 m_mustPopLocalFrame = 0 == m_jEnv->PushLocalFrame(numLocalRefs);
97 bool m_mustDetachExplicitely: 1;
98 bool m_mustPopLocalFrame: 1;
Platform-dependent helpers.
CAkJNIThread(JavaVM *jvm, int numLocalRefs)
Utility class for acquiring a pointer to a valid JNI environment attached to the current thread (with...
CAkJNIThread(JavaVM *jvm)
Tell us about your project. We're here to help.
Register your project and we'll help you get started with no strings attached!
Get started with Wwise