diff --git a/libs/util/source/threadpool.cpp b/libs/util/source/threadpool.cpp index e0fa4e47..3faa2111 100644 --- a/libs/util/source/threadpool.cpp +++ b/libs/util/source/threadpool.cpp @@ -20,9 +20,10 @@ namespace psemek::util { for (std::size_t th = 0; th < thread_count; ++th) { - threads_.emplace_back([this, &name, th, thread_count] + std::string tname = thread_count == 1 ? name : to_string(name, '#', th); + threads_.emplace_back([this, tname = std::move(tname), th, thread_count] { - log::register_thread(thread_count == 1 ? name : to_string(name, '#', th)); + log::register_thread(tname); for (bool running = true; running;) { auto task = task_queue_.pop();