summaryrefslogtreecommitdiff
path: root/firmware/target/hosted/android/system-target.h
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2011-03-16 14:33:55 +0000
committerThomas Martitz <kugel@rockbox.org>2011-03-16 14:33:55 +0000
commit046cec3aa7fd58a9519cad8d693b47a2400e1742 (patch)
treecb0ba0773a3e8b3cef5d7690e2822f03d1425ddb /firmware/target/hosted/android/system-target.h
parentefa9f13500d1672d0b631520e92e08f3ff61e45c (diff)
downloadrockbox-046cec3aa7fd58a9519cad8d693b47a2400e1742.tar.gz
rockbox-046cec3aa7fd58a9519cad8d693b47a2400e1742.zip
Android: Partly revert r29569 and only call the new getJavaEnvironment() when needed.
The environment is fine to share in general, just not across OS threads, so it's only needed for functions which are possibly called from multiple OS threads (only 1 currently). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29601 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/hosted/android/system-target.h')
-rw-r--r--firmware/target/hosted/android/system-target.h24
1 files changed, 9 insertions, 15 deletions
diff --git a/firmware/target/hosted/android/system-target.h b/firmware/target/hosted/android/system-target.h
index 9145ab1e84..325c1012af 100644
--- a/firmware/target/hosted/android/system-target.h
+++ b/firmware/target/hosted/android/system-target.h
@@ -21,8 +21,6 @@
21#ifndef __SYSTEM_TARGET_H__ 21#ifndef __SYSTEM_TARGET_H__
22#define __SYSTEM_TARGET_H__ 22#define __SYSTEM_TARGET_H__
23 23
24#include <jni.h>
25
26#define disable_irq() 24#define disable_irq()
27#define enable_irq() 25#define enable_irq()
28#define disable_irq_save() 0 26#define disable_irq_save() 0
@@ -32,19 +30,15 @@ void power_off(void);
32void wait_for_interrupt(void); 30void wait_for_interrupt(void);
33void interrupt(void); 31void interrupt(void);
34 32
35/* A JNI environment is specific to its thread, so use the correct way to 33 /* don't pull in jni.h for every user of this file, it should be only needed
36 * obtain it: share a pointer to the JavaVM structure and ask that the JNI 34 * within the target tree (if at all)
37 * environment attached to the current thread. */ 35 * define this before #including system.h or system-target.h */
38static inline JNIEnv* getJavaEnvironment(void) 36#ifdef _SYSTEM_WITH_JNI
39{ 37#include <jni.h>
40 extern JavaVM *vm_ptr; 38/*
41 JNIEnv *env = NULL; 39 * discover the JNIEnv for this the calling thread in case it's not known */
42 40extern JNIEnv* getJavaEnvironment(void);
43 if (vm_ptr) 41#endif /* _SYSTEM_WITH_JNI */
44 (*vm_ptr)->GetEnv(vm_ptr, (void**) &env, JNI_VERSION_1_2);
45
46 return env;
47}
48 42
49#endif /* __SYSTEM_TARGET_H__ */ 43#endif /* __SYSTEM_TARGET_H__ */
50 44