MCPcopy Create free account
hub / github.com/cinder/Cinder / JvmHelper_Attach

Function JvmHelper_Attach

src/cinder/android/JniHelper.cpp:151–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149}
150
151static JNIEnv* JvmHelper_Attach()
152{
153 JNIEnv* jniEnv = nullptr;
154 if( nullptr != sJavaVm ) {
155 if( JNI_OK != sJavaVm->AttachCurrentThread( &jniEnv, nullptr ) ) {
156 jniEnv = nullptr;
157 }
158 }
159
160 void* value = pthread_getspecific( sThreadExitKey );
161 if( nullptr == value ) {
162 JniThreadVars* threadVars = new JniThreadVars();
163 if( 0 == pthread_setspecific( sThreadExitKey, (void*)threadVars ) ) {
164 dbg_app_log( "JvmHelper_Attach -> allocated JNI threadVars (via pthread_setspecific)" );
165 }
166 else {
167 dbg_app_error( "vmHelper_Attach -> pthread_setspecific failed allocating JNI threadVars!" );
168 delete threadVars;
169 }
170 }
171
172 return jniEnv;
173}
174
175static void JvmHelper_Deatch()
176{

Callers 2

JvmHelper_CurrentJniEnvFunction · 0.85
AttachCurrentThreadMethod · 0.85

Calls 3

dbg_app_logFunction · 0.85
dbg_app_errorFunction · 0.85
AttachCurrentThreadMethod · 0.80

Tested by

no test coverage detected