app: simplify and document init sequence

The global constructor added for -buildmode=c-shared takes care
of a lot of the messier steps that were being done here.

Change-Id: I00525765855b2ad0fcecb0639d6a7ee3feea9ed9
Reviewed-on: https://go-review.googlesource.com/9648
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
This commit is contained in:
David Crawshaw
2015-05-04 12:09:13 +00:00
parent b364bb0348
commit 66ea9e5b49
6 changed files with 28 additions and 152 deletions
+1 -3
View File
@@ -188,9 +188,7 @@ void init_seq(void *javavm) {
JNIEnv *env;
int res = (*vm)->GetEnv(vm, (void**)&env, JNI_VERSION_1_6);
if (res == JNI_EDETACHED) {
JavaVMAttachArgs args;
args.version = JNI_VERSION_1_6;
if ((*vm)->AttachCurrentThread(vm, &env, &args) != 0) {
if ((*vm)->AttachCurrentThread(vm, &env, NULL) != 0) {
LOG_FATAL("cannot attach to current_vm");
}
} else if (res != 0) {