From 2884e920417b5ab3f540c465ccbb1ba39ab263e2 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 24 Sep 2017 03:03:37 +0900 Subject: [PATCH] jni: Add more comment --- internal/jni/jni_android.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/jni/jni_android.go b/internal/jni/jni_android.go index ee45b3005..5f5523738 100644 --- a/internal/jni/jni_android.go +++ b/internal/jni/jni_android.go @@ -11,7 +11,7 @@ package jni #include // These definitions are duplicated with those in ctx_android.go of golang.org/x/mobile/internal/mobileinit package. -// To be exact, this might cause undefined behavior, but some compilers including GCC work as a common extension. +// To be exact, this might cause undefined behavior, but some compilers including GCC and Clang work as a common extension. // (J.5.11 Multiple external definitions) JavaVM* current_vm; jobject current_ctx; @@ -72,6 +72,9 @@ import ( "unsafe" ) +// RunOnJVM executes fn on the current VM context. +// +// RunOnJVM should not be called on init function since the current VM might not be initialized yet. func RunOnJVM(fn func(vm, env, ctx uintptr) error) error { errch := make(chan error) go func() {