aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALc.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-10-02 12:40:26 -0700
committerChris Robinson <[email protected]>2018-10-02 12:40:26 -0700
commitc39eeb963895a2eb05e17bc28c357f7d3f4ce815 (patch)
tree1cb89bf63c60f4d81248d19f34157bc82dd200f0 /Alc/ALc.c
parent493c8bbc833a4b5f58c82913af913946926b194f (diff)
Don't try to get the JNIEnv on Android
It's currently not used. More stuff is needed anyway which may need a different approach.
Diffstat (limited to 'Alc/ALc.c')
-rw-r--r--Alc/ALc.c69
1 files changed, 0 insertions, 69 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index de6a2b75..47351b99 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -1165,75 +1165,6 @@ static void alc_initconfig(void)
}
#define DO_INITCONFIG() alcall_once(&alc_config_once, alc_initconfig)
-#ifdef __ANDROID__
-#include <jni.h>
-
-static JavaVM *gJavaVM;
-static pthread_key_t gJVMThreadKey;
-
-static void CleanupJNIEnv(void* UNUSED(ptr))
-{
- JCALL0(gJavaVM,DetachCurrentThread)();
-}
-
-void *Android_GetJNIEnv(void)
-{
- if(!gJavaVM)
- {
- WARN("gJavaVM is NULL!\n");
- return NULL;
- }
-
- /* http://developer.android.com/guide/practices/jni.html
- *
- * All threads are Linux threads, scheduled by the kernel. They're usually
- * started from managed code (using Thread.start), but they can also be
- * created elsewhere and then attached to the JavaVM. For example, a thread
- * started with pthread_create can be attached with the JNI
- * AttachCurrentThread or AttachCurrentThreadAsDaemon functions. Until a
- * thread is attached, it has no JNIEnv, and cannot make JNI calls.
- * Attaching a natively-created thread causes a java.lang.Thread object to
- * be constructed and added to the "main" ThreadGroup, making it visible to
- * the debugger. Calling AttachCurrentThread on an already-attached thread
- * is a no-op.
- */
- JNIEnv *env = pthread_getspecific(gJVMThreadKey);
- if(!env)
- {
- int status = JCALL(gJavaVM,AttachCurrentThread)(&env, NULL);
- if(status < 0)
- {
- ERR("Failed to attach current thread\n");
- return NULL;
- }
- pthread_setspecific(gJVMThreadKey, env);
- }
- return env;
-}
-
-/* Automatically called by JNI. */
-JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *jvm, void* UNUSED(reserved))
-{
- void *env;
- int err;
-
- gJavaVM = jvm;
- if(JCALL(gJavaVM,GetEnv)(&env, JNI_VERSION_1_4) != JNI_OK)
- {
- ERR("Failed to get JNIEnv with JNI_VERSION_1_4\n");
- return JNI_ERR;
- }
-
- /* Create gJVMThreadKey so we can keep track of the JNIEnv assigned to each
- * thread. The JNIEnv *must* be detached before the thread is destroyed.
- */
- if((err=pthread_key_create(&gJVMThreadKey, CleanupJNIEnv)) != 0)
- ERR("pthread_key_create failed: %d\n", err);
- pthread_setspecific(gJVMThreadKey, env);
- return JNI_VERSION_1_4;
-}
-#endif
-
/************************************************
* Library deinitialization