Return a |JNIEnv*| usable on this thread or NULL if this thread is detached.
| 98 | |
| 99 | // Return a |JNIEnv*| usable on this thread or NULL if this thread is detached. |
| 100 | JNIEnv* getEnv() { |
| 101 | void* env = nullptr; |
| 102 | [[maybe_unused]] jint status = gJvm->GetEnv(&env, JNI_VERSION_1_6); |
| 103 | assert(((env != nullptr) && (status == JNI_OK)) || ((env == nullptr) && (status == JNI_EDETACHED))); |
| 104 | return reinterpret_cast<JNIEnv*>(env); |
| 105 | } |
| 106 | |
| 107 | bool attachThreadIfNeeded(const char* threadName) { |
| 108 | // check if already attached |
no outgoing calls
no test coverage detected