From 85908c338112ff8d5bbe3fc4cb63258af5b38a8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Wed, 19 Aug 2015 17:47:05 -0400 Subject: [PATCH] reset the ThreadContext after the last loop iteration --- src/mbgl/util/thread.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mbgl/util/thread.hpp b/src/mbgl/util/thread.hpp index a0c39abad..b0d17bd52 100644 --- a/src/mbgl/util/thread.hpp +++ b/src/mbgl/util/thread.hpp @@ -112,9 +112,9 @@ template void Thread::run(ThreadContext context, P&& params, std::index_sequence) { uv::loop l; - { - ThreadContext::current.set(&context); + ThreadContext::current.set(&context); + { RunLoop loop_(l.get()); loop = &loop_; @@ -126,13 +126,13 @@ void Thread::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(); }