summaryrefslogtreecommitdiff
path: root/platform/qt/src/run_loop.cpp
diff options
context:
space:
mode:
authorIvo van Dongen <info@ivovandongen.nl>2017-07-25 18:35:38 +0300
committerIvo van Dongen <ivovandongen@users.noreply.github.com>2017-08-09 12:08:21 +0300
commitf4f4d13b70cfc26e44c7cbc679acbe9609ae2936 (patch)
treef8dcd4f78ddf2f5d3e0227add7cd6bc3603515dd /platform/qt/src/run_loop.cpp
parent2a8cc4b3e15037554fb357f882a67472adb4161e (diff)
downloadqtlocation-mapboxgl-f4f4d13b70cfc26e44c7cbc679acbe9609ae2936.tar.gz
[all] ensure runloop is the current scheduler
Diffstat (limited to 'platform/qt/src/run_loop.cpp')
-rw-r--r--platform/qt/src/run_loop.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/platform/qt/src/run_loop.cpp b/platform/qt/src/run_loop.cpp
index c44f284852..71ea19032a 100644
--- a/platform/qt/src/run_loop.cpp
+++ b/platform/qt/src/run_loop.cpp
@@ -1,6 +1,6 @@
#include "run_loop_impl.hpp"
-#include <mbgl/util/thread_local.hpp>
+#include <mbgl/actor/scheduler.hpp>
#include <QCoreApplication>
@@ -8,13 +8,6 @@
#include <functional>
#include <utility>
-namespace {
-
-using namespace mbgl::util;
-static ThreadLocal<RunLoop>& current = *new ThreadLocal<RunLoop>;
-
-}
-
namespace mbgl {
namespace util {
@@ -27,7 +20,8 @@ void RunLoop::Impl::onWriteEvent(int fd) {
}
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>()) {
@@ -42,14 +36,14 @@ RunLoop::RunLoop(Type type) : impl(std::make_unique<Impl>()) {
impl->type = type;
- current.set(this);
+ Scheduler::SetCurrent(this);
impl->async = std::make_unique<AsyncTask>(std::bind(&RunLoop::process, this));
}
RunLoop::~RunLoop() {
MBGL_VERIFY_THREAD(tid);
- current.set(nullptr);
+ Scheduler::SetCurrent(nullptr);
}
LOOP_HANDLE RunLoop::getLoopHandle() {