From 383627e23c4eb5178513376e48113d6d6e9a048f Mon Sep 17 00:00:00 2001 From: Constantin Shalnev Date: Wed, 5 Aug 2015 15:59:26 +0300 Subject: [PATCH] Use SimpleThread --- routing/async_router.cpp | 15 +-------------- routing/async_router.hpp | 5 +++-- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/routing/async_router.cpp b/routing/async_router.cpp index 453a2fb6cd..1db36e526b 100644 --- a/routing/async_router.cpp +++ b/routing/async_router.cpp @@ -9,11 +9,6 @@ #include "indexer/mercator.hpp" -#if defined(OMIM_OS_ANDROID) -void AndroidThreadAttachToJVM(); -void AndroidThreadDetachFromJVM(); -#endif // defined(OMIM_OS_ANDROID) - namespace routing { @@ -124,7 +119,7 @@ AsyncRouter::AsyncRouter(TRoutingStatisticsCallback const & routingStatisticsCal m_routingStatisticsCallback(routingStatisticsCallback), m_pointCheckCallback(pointCheckCallback) { - m_thread = thread(bind(&AsyncRouter::ThreadFunc, this)); + m_thread = threads::SimpleThread(&AsyncRouter::ThreadFunc, this); } AsyncRouter::~AsyncRouter() @@ -234,10 +229,6 @@ void AsyncRouter::ResetDelegate() void AsyncRouter::ThreadFunc() { -#if defined(OMIM_OS_ANDROID) - AndroidThreadAttachToJVM(); -#endif // defined(OMIM_OS_ANDROID) - while (true) { { @@ -250,10 +241,6 @@ void AsyncRouter::ThreadFunc() CalculateRoute(); } - -#if defined(OMIM_OS_ANDROID) - AndroidThreadDetachFromJVM(); -#endif // defined(OMIM_OS_ANDROID) } void AsyncRouter::CalculateRoute() diff --git a/routing/async_router.hpp b/routing/async_router.hpp index a290e8702b..beb75ab254 100644 --- a/routing/async_router.hpp +++ b/routing/async_router.hpp @@ -5,12 +5,13 @@ #include "router.hpp" #include "router_delegate.hpp" +#include "base/thread.hpp" + #include "std/condition_variable.hpp" #include "std/map.hpp" #include "std/mutex.hpp" #include "std/shared_ptr.hpp" #include "std/string.hpp" -#include "std/thread.hpp" #include "std/unique_ptr.hpp" namespace routing @@ -103,7 +104,7 @@ private: mutex m_guard; /// Thread which executes routing calculation - thread m_thread; + threads::SimpleThread m_thread; condition_variable m_threadCondVar; bool m_threadExit; bool m_hasRequest;