summaryrefslogtreecommitdiff
path: root/src/mbgl/util/thread_pool.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/util/thread_pool.cpp')
-rw-r--r--src/mbgl/util/thread_pool.cpp3
1 files changed, 3 insertions, 0 deletions
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;
}