diff options
author | Tor Lillqvist <tml@iki.fi> | 2012-02-15 12:00:46 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@iki.fi> | 2012-02-15 12:00:46 +0200 |
commit | c301199804f5beb7ef803abfa84e04d9351efb3f (patch) | |
tree | 991cfa7a033d7fc76e5ea76ca2a10363b1bc5271 /sal/osl/unx/thread.c | |
parent | bc7110a06be5304e00f8ed94c278f5b9a476c002 (diff) | |
parent | 71fb61b77a548ac8b0b499f7c6039e197c994842 (diff) |
Merge branch 'feature/android'
Diffstat (limited to 'sal/osl/unx/thread.c')
-rw-r--r-- | sal/osl/unx/thread.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sal/osl/unx/thread.c b/sal/osl/unx/thread.c index 4128d08f0d63..59a0514b322b 100644 --- a/sal/osl/unx/thread.c +++ b/sal/osl/unx/thread.c @@ -37,6 +37,10 @@ #include <rtl/textenc.h> #include <rtl/alloc.h> #include <sal/macros.h> +#ifdef ANDROID +#include <jni.h> +#include <osl/detail/android-bootstrap.h> +#endif #if defined LINUX && ! defined __FreeBSD_kernel__ #include <sys/prctl.h> @@ -288,8 +292,22 @@ static void* osl_thread_start_Impl (void* pData) if (!terminate) { +#ifdef ANDROID + { + JNIEnv* env = 0; + int res = (*lo_get_javavm())->AttachCurrentThread(lo_get_javavm(), &env, NULL); // res == 0 + fprintf (stderr, "new sal thread started and attached %d!\n", res); + } +#endif /* call worker function */ pImpl->m_WorkerFunction(pImpl->m_pData); + +#ifdef ANDROID + { + int res = (*lo_get_javavm())->DetachCurrentThread(lo_get_javavm()); + fprintf (stderr, "detached finished sal thread %d!\n", res); + } +#endif } /* call cleanup handler and leave */ |