From 278116386a230b952b6894c17d569aea3b13c3ce Mon Sep 17 00:00:00 2001 From: 13579xxl <13807918069@qq.com> Date: Mon, 16 Oct 2023 23:09:29 +0800 Subject: [PATCH] Maybe use the lock_guard will be better --- ThreadPool.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ThreadPool.h b/ThreadPool.h index 4183203..85bbf15 100644 --- a/ThreadPool.h +++ b/ThreadPool.h @@ -87,7 +87,7 @@ auto ThreadPool::enqueue(F&& f, Args&&... args) inline ThreadPool::~ThreadPool() { { - std::unique_lock lock(queue_mutex); + std::lock_guard lock(queue_mutex); stop = true; } condition.notify_all();