summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2015-08-19 17:47:05 -0400
committerKonstantin Käfer <mail@kkaefer.com>2015-08-19 17:47:05 -0400
commit85908c338112ff8d5bbe3fc4cb63258af5b38a8b (patch)
tree40626a861f49ad02c1624d4e8a75e65a9fb70529
parent90bae75838f223a88a08a43380b405ec5e373591 (diff)
downloadqtlocation-mapboxgl-85908c338112ff8d5bbe3fc4cb63258af5b38a8b.tar.gz
reset the ThreadContext after the last loop iteration
-rw-r--r--src/mbgl/util/thread.hpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mbgl/util/thread.hpp b/src/mbgl/util/thread.hpp
index a0c39abad0..b0d17bd52c 100644
--- a/src/mbgl/util/thread.hpp
+++ b/src/mbgl/util/thread.hpp
@@ -112,9 +112,9 @@ template <typename P, std::size_t... I>
void Thread<Object>::run(ThreadContext context, P&& params, std::index_sequence<I...>) {
uv::loop l;
- {
- ThreadContext::current.set(&context);
+ ThreadContext::current.set(&context);
+ {
RunLoop loop_(l.get());
loop = &loop_;
@@ -126,13 +126,13 @@ void Thread<Object>::run(ThreadContext context, P&& params, std::index_sequence<
loop = nullptr;
object = nullptr;
-
- ThreadContext::current.set(nullptr);
}
// Run the loop again to ensure that async close callbacks have been called.
l.run();
+ ThreadContext::current.set(nullptr);
+
joinable.get_future().get();
}