From a44d56c751326ff908fd992f1c2798bf2b6efd27 Mon Sep 17 00:00:00 2001 From: Constantin Shalnev Date: Tue, 4 Aug 2015 20:12:39 +0300 Subject: [PATCH] Join to Android JVM from the worker thread --- routing/async_router.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/routing/async_router.cpp b/routing/async_router.cpp index 8a66dc7726..75d5dc4d09 100644 --- a/routing/async_router.cpp +++ b/routing/async_router.cpp @@ -9,6 +9,11 @@ #include "indexer/mercator.hpp" +#if defined(OMIM_OS_ANDROID) +void AndroidThreadAttachToJVM(); +void AndroidThreadDetachFromJVM(); +#endif // defined(OMIM_OS_ANDROID) + namespace routing { @@ -223,6 +228,10 @@ void AsyncRouter::ResetDelegate() void AsyncRouter::ThreadFunc() { +#if defined(OMIM_OS_ANDROID) + AndroidThreadAttachToJVM(); +#endif // defined(OMIM_OS_ANDROID) + while (true) { { @@ -235,6 +244,10 @@ void AsyncRouter::ThreadFunc() CalculateRoute(); } + +#if defined(OMIM_OS_ANDROID) + AndroidThreadDetachFromJVM(); +#endif // defined(OMIM_OS_ANDROID) } void AsyncRouter::CalculateRoute()