diff options
author | Łukasz Paczos <lukas.paczos@gmail.com> | 2019-05-21 12:45:01 +0200 |
---|---|---|
committer | Łukasz Paczos <lukasz.paczos@mapbox.com> | 2019-05-22 15:52:55 +0200 |
commit | 7d6255c8605bd18a7c7d90de19346392a51c90b7 (patch) | |
tree | 65b52ac4f4b4e64598dcc885a161251d62c5d38e /src | |
parent | e79080771b36ad3a4be0dee8ca12032cd1c8488a (diff) | |
download | qtlocation-mapboxgl-7d6255c8605bd18a7c7d90de19346392a51c90b7.tar.gz |
[core] option to perform platform specific operations when creating/destroying core threads
Diffstat (limited to 'src')
-rw-r--r-- | src/core-files.json | 1 | ||||
-rw-r--r-- | src/mbgl/util/thread_pool.cpp | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/src/core-files.json b/src/core-files.json index 2385b18c3f..05870661db 100644 --- a/src/core-files.json +++ b/src/core-files.json @@ -351,6 +351,7 @@ "mbgl/math/minmax.hpp": "include/mbgl/math/minmax.hpp", "mbgl/math/wrap.hpp": "include/mbgl/math/wrap.hpp", "mbgl/platform/gl_functions.hpp": "include/mbgl/platform/gl_functions.hpp", + "mbgl/platform/thread.hpp": "include/mbgl/platform/thread.hpp", "mbgl/renderer/query.hpp": "include/mbgl/renderer/query.hpp", "mbgl/renderer/renderer.hpp": "include/mbgl/renderer/renderer.hpp", "mbgl/renderer/renderer_frontend.hpp": "include/mbgl/renderer/renderer_frontend.hpp", diff --git a/src/mbgl/util/thread_pool.cpp b/src/mbgl/util/thread_pool.cpp index 79c2f75012..e839d1b4be 100644 --- a/src/mbgl/util/thread_pool.cpp +++ b/src/mbgl/util/thread_pool.cpp @@ -2,6 +2,7 @@ #include <mbgl/util/platform.hpp> #include <mbgl/util/string.hpp> +#include <mbgl/platform/thread.hpp> namespace mbgl { @@ -11,6 +12,7 @@ ThreadPool::ThreadPool(std::size_t count) { for (std::size_t i = 0; i < count; ++i) { threads.emplace_back([this, i]() { platform::setCurrentThreadName(std::string{ "Worker " } + util::toString(i + 1)); + platform::attachThread(); while (true) { std::unique_lock<std::mutex> lock(mutex); @@ -20,6 +22,7 @@ ThreadPool::ThreadPool(std::size_t count) { }); if (terminate) { + platform::detachThread(); return; } |