diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2015-05-01 18:24:58 -0400 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2015-05-01 18:24:58 -0400 |
commit | b713930c7f08b511f1cf6dbd79e803840de71889 (patch) | |
tree | 5546ea78b741ae10c332b869fc3a4f38ae7b50b6 /src/mbgl/util/thread.hpp | |
parent | 24695f6c0274cac8ae17df3765e0cc54c5668047 (diff) | |
parent | 4c8f716f20bd95c9821b20a6c30ab7af35bf1497 (diff) | |
download | qtlocation-mapboxgl-b713930c7f08b511f1cf6dbd79e803840de71889.tar.gz |
Merge branch 'uv_leak'
Diffstat (limited to 'src/mbgl/util/thread.hpp')
-rw-r--r-- | src/mbgl/util/thread.hpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/mbgl/util/thread.hpp b/src/mbgl/util/thread.hpp index 189182464c..0d46d12b72 100644 --- a/src/mbgl/util/thread.hpp +++ b/src/mbgl/util/thread.hpp @@ -77,11 +77,6 @@ public: return future.get(); } - // Join the thread, but call the given function repeatedly in the current thread - // while waiting for the join to finish. This should be immediately followed by - // destroying the Thread. - void pumpingStop(std::function<void ()>); - private: Thread(const Thread&) = delete; Thread(Thread&&) = delete; @@ -124,21 +119,24 @@ Thread<Object>::Thread(const std::string& name, Args&&... args) { template <class Object> template <typename P, std::size_t... I> void Thread<Object>::run(P&& params, index_sequence<I...>) { - RunLoop loop_; - loop = &loop_; + uv::loop l; { - Object object_(loop_.get(), std::get<I>(std::forward<P>(params))...); + Object object_(l.get(), std::get<I>(std::forward<P>(params))...); object = &object_; + RunLoop loop_(l.get()); + loop = &loop_; + running.set_value(); - loop_.run(); + l.run(); + loop = nullptr; object = nullptr; } // Run the loop again to ensure that async close callbacks have been called. - loop_.run(); + l.run(); joinable.get_future().get(); } |