summaryrefslogtreecommitdiff
path: root/platform/default
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/default
parent2a8cc4b3e15037554fb357f882a67472adb4161e (diff)
downloadqtlocation-mapboxgl-f4f4d13b70cfc26e44c7cbc679acbe9609ae2936.tar.gz
[all] ensure runloop is the current scheduler
Diffstat (limited to 'platform/default')
-rw-r--r--platform/default/run_loop.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/platform/default/run_loop.cpp b/platform/default/run_loop.cpp
index 98d1badcb5..6375dba78e 100644
--- a/platform/default/run_loop.cpp
+++ b/platform/default/run_loop.cpp
@@ -1,6 +1,7 @@
#include <mbgl/util/run_loop.hpp>
#include <mbgl/util/async_task.hpp>
#include <mbgl/util/thread_local.hpp>
+#include <mbgl/actor/scheduler.hpp>
#include <uv.h>
@@ -10,9 +11,6 @@
namespace {
-using namespace mbgl::util;
-static ThreadLocal<RunLoop>& current = *new ThreadLocal<RunLoop>;
-
void dummyCallback(uv_async_t*) {}
} // namespace
@@ -53,7 +51,8 @@ struct Watch {
};
RunLoop* RunLoop::Get() {
- return current.get();
+ assert(static_cast<RunLoop*>(Scheduler::GetCurrent()));
+ return static_cast<RunLoop*>(Scheduler::GetCurrent());
}
class RunLoop::Impl {
@@ -98,12 +97,12 @@ 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() {
- current.set(nullptr);
+ Scheduler::SetCurrent(nullptr);
// Close the dummy handle that we have
// just to keep the main loop alive.
@@ -127,7 +126,7 @@ RunLoop::~RunLoop() {
}
LOOP_HANDLE RunLoop::getLoopHandle() {
- return current.get()->impl->loop;
+ return Get()->impl->loop;
}
void RunLoop::push(std::shared_ptr<WorkTask> task) {