Fix threadpool name use-after-free bug
This commit is contained in:
parent
240d26663b
commit
fb9f1d8f30
1 changed files with 3 additions and 2 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue