debug_DispatchQueue_ThreadPool_DeadLock

This commit is contained in:
mike_debug 2025-05-30 09:57:19 +08:00
parent 65c2943191
commit 7c540b9b5f
1 changed files with 2 additions and 1 deletions

View File

@ -42,11 +42,12 @@ void
DispatchQueue::setThreadCount(size_t thread_count)
{
terminateThreads();
std::unique_lock<std::mutex> lock(lock_);
threads_.resize(thread_count);
for(size_t i = 0; i < thread_count; i++) {
threads_[i] = std::thread(&DispatchQueue::dispatch_thread_handler, this, i);
}
quit_ = false;
}
void