forked from len0rd/rockbox
Android: Don't share the JNI environment across threads, but obtain it the
correct way git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29569 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
2e5b7aebde
commit
66f2a08f8a
10 changed files with 60 additions and 16 deletions
|
@ -21,6 +21,8 @@
|
|||
#ifndef __SYSTEM_TARGET_H__
|
||||
#define __SYSTEM_TARGET_H__
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
#define disable_irq()
|
||||
#define enable_irq()
|
||||
#define disable_irq_save() 0
|
||||
|
@ -30,6 +32,20 @@ void power_off(void);
|
|||
void wait_for_interrupt(void);
|
||||
void interrupt(void);
|
||||
|
||||
/* A JNI environment is specific to its thread, so use the correct way to
|
||||
* obtain it: share a pointer to the JavaVM structure and ask that the JNI
|
||||
* environment attached to the current thread. */
|
||||
static inline JNIEnv* getJavaEnvironment(void)
|
||||
{
|
||||
extern JavaVM *vm_ptr;
|
||||
JNIEnv *env = NULL;
|
||||
|
||||
if (vm_ptr)
|
||||
(*vm_ptr)->GetEnv(vm_ptr, (void**) &env, JNI_VERSION_1_2);
|
||||
|
||||
return env;
|
||||
}
|
||||
|
||||
#endif /* __SYSTEM_TARGET_H__ */
|
||||
|
||||
#define NEED_GENERIC_BYTESWAPS
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue