MCPcopy Create free account
hub / github.com/acl-dev/acl / get_env

Function get_env

android/samples/fiber/http/src/main/cpp/http_client.cpp:29–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27static jobject g_fiber = NULL;
28
29static JNIEnv* get_env(void) {
30 JNIEnv* env;
31 int status = g_jvm->GetEnv((void**) &env, JNI_VERSION_1_6);
32 if (status == JNI_EDETACHED || env == NULL) {
33 log_info("get_env: status=%d, %d, env=%p",
34 status, JNI_EDETACHED, env);
35 status = g_jvm->AttachCurrentThread(&env, NULL);
36 if (status != JNI_OK || env == NULL) {
37 log_error("get_env: AttachCurrentThread failed");
38 return NULL;
39 }
40 log_info("get_env: status=%d, env=%p", status, env);
41 }
42
43 if (env->ExceptionOccurred()) {
44 log_error("%d: some exception happened!", __LINE__);
45 env->ExceptionDescribe();
46 env->ExceptionClear();
47 return NULL;
48 }
49
50 log_info("get_env: get env=%p ok, status=%d", env, status);
51 return env;
52}
53
54static void test1(void) {
55 log_info("test1: jvm=%p", g_jvm);

Callers 2

test1Function · 0.70
test2Function · 0.70

Calls 2

log_infoFunction · 0.70
log_errorFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…