diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-09-16 14:48:46 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-09-24 16:14:09 +0200 |
commit | 6c526e56370a0f4dee9a4b6ed45489fcb14e3ff1 (patch) | |
tree | c4af9112bcd5e5670054d1374b67b3857f93d432 /include | |
parent | d9fc7708a2dfb6e2506a5d10d896a813557c056d (diff) | |
download | qtlocation-mapboxgl-6c526e56370a0f4dee9a4b6ed45489fcb14e3ff1.tar.gz |
make sure all of our async handles are stopped before stopping the map thread
Diffstat (limited to 'include')
-rw-r--r-- | include/mbgl/map/map.hpp | 11 | ||||
-rw-r--r-- | include/mbgl/storage/base_request.hpp | 6 | ||||
-rw-r--r-- | include/mbgl/storage/file_request.hpp | 2 | ||||
-rw-r--r-- | include/mbgl/util/uv_detail.hpp | 13 |
4 files changed, 14 insertions, 18 deletions
diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index 98951a375c..3b2c97122e 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -160,9 +160,9 @@ private: bool async = false; std::shared_ptr<uv::loop> loop; std::unique_ptr<uv::thread> thread; - uv_async_t *async_terminate = nullptr; - uv_async_t *async_render = nullptr; - uv_async_t *async_cleanup = nullptr; + std::unique_ptr<uv_async_t> async_terminate; + std::unique_ptr<uv_async_t> async_render; + std::unique_ptr<uv_async_t> async_cleanup; private: // If cleared, the next time the render thread attempts to render the map, it will *actually* @@ -181,6 +181,11 @@ public: View &view; private: +#ifndef NDEBUG + const unsigned long main_thread; + unsigned long map_thread = -1; +#endif + Transform transform; TransformState state; diff --git a/include/mbgl/storage/base_request.hpp b/include/mbgl/storage/base_request.hpp index b8ebd368e4..05ef1e4a7b 100644 --- a/include/mbgl/storage/base_request.hpp +++ b/include/mbgl/storage/base_request.hpp @@ -25,7 +25,7 @@ private: BaseRequest& operator=(BaseRequest &&) = delete; public: - BaseRequest(); + BaseRequest(const std::string &path); virtual ~BaseRequest(); Callback *add(Callback &&callback, const std::shared_ptr<BaseRequest> &request); @@ -34,10 +34,14 @@ public: public: const unsigned long thread_id; + const std::string path; std::unique_ptr<Response> response; private: + // This object may hold a shared_ptr to itself. It does this to prevent destruction of this object + // while a request is in progress. std::shared_ptr<BaseRequest> self; + std::forward_list<std::unique_ptr<Callback>> callbacks; }; diff --git a/include/mbgl/storage/file_request.hpp b/include/mbgl/storage/file_request.hpp index 156fd6dfe7..331ed8421f 100644 --- a/include/mbgl/storage/file_request.hpp +++ b/include/mbgl/storage/file_request.hpp @@ -20,8 +20,6 @@ public: ~FileRequest(); private: - const std::string path; - const unsigned long thread_id; FileRequestBaton *ptr = nullptr; friend struct FileRequestBaton; diff --git a/include/mbgl/util/uv_detail.hpp b/include/mbgl/util/uv_detail.hpp index c65c247ba1..eefb5ac8df 100644 --- a/include/mbgl/util/uv_detail.hpp +++ b/include/mbgl/util/uv_detail.hpp @@ -2,20 +2,9 @@ #define MBGL_UTIL_UV_DETAIL #include <uv.h> + #include <functional> #include <cassert> - -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunused-parameter" -#endif - -#include <boost/lockfree/queue.hpp> - -#ifdef __clang__ -#pragma clang diagnostic pop -#endif - #include <string> |