MCPcopy Create free account
hub / github.com/defold/defold / ThreadAttacher

Method ThreadAttacher

engine/dlib/src/dlib/android.cpp:35–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33}
34
35ThreadAttacher::ThreadAttacher()
36: m_Activity(NULL)
37, m_Env(NULL)
38, m_IsAttached(false)
39{
40 struct android_app* app = dmAndroid::GetAndroidApp();
41 if (app)
42 {
43 m_Activity = app->activity;
44
45 if (m_Activity->vm->GetEnv((void **)&m_Env, JNI_VERSION_1_6) != JNI_OK)
46 {
47 m_Activity->vm->AttachCurrentThread(&m_Env, 0);
48 m_IsAttached = true;
49 }
50 }
51}
52
53bool ThreadAttacher::Detach()
54{

Callers

nothing calls this directly

Calls 2

GetEnvMethod · 0.80
GetAndroidAppFunction · 0.70

Tested by

no test coverage detected