diff options
Diffstat (limited to 'platform/android/src/run_loop.cpp')
-rw-r--r-- | platform/android/src/run_loop.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/platform/android/src/run_loop.cpp b/platform/android/src/run_loop.cpp index 3c605b70e8..dff7d1d984 100644 --- a/platform/android/src/run_loop.cpp +++ b/platform/android/src/run_loop.cpp @@ -4,6 +4,7 @@ #include <mbgl/util/thread_local.hpp> #include <mbgl/util/thread.hpp> #include <mbgl/util/timer.hpp> +#include <mbgl/actor/scheduler.hpp> #include <android/looper.h> @@ -23,7 +24,6 @@ namespace { using namespace mbgl::util; -static ThreadLocal<RunLoop>& current = *new ThreadLocal<RunLoop>; int looperCallbackNew(int fd, int, void* data) { int buffer[1]; @@ -200,19 +200,20 @@ Milliseconds RunLoop::Impl::processRunnables() { } RunLoop* RunLoop::Get() { - return current.get(); + assert(static_cast<RunLoop*>(Scheduler::GetCurrent())); + return static_cast<RunLoop*>(Scheduler::GetCurrent()); } RunLoop::RunLoop(Type type) : impl(std::make_unique<Impl>(this, type)) { - current.set(this); + Scheduler::SetCurrent(this); } RunLoop::~RunLoop() { - current.set(nullptr); + Scheduler::SetCurrent(nullptr); } LOOP_HANDLE RunLoop::getLoopHandle() { - return current.get()->impl.get(); + return Get()->impl.get(); } void RunLoop::push(std::shared_ptr<WorkTask> task) { |