From c855173001306b6f1e4f761aa953c52d2ae2dcd5 Mon Sep 17 00:00:00 2001 From: "Lovelace.Lee" Date: Fri, 14 Jul 2023 10:59:31 +0800 Subject: [PATCH] Update periodic_worker-inl.h Fix: Make this great log library DRD through cleanly test by valgrind --tool=drd. --- include/spdlog/details/periodic_worker-inl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/spdlog/details/periodic_worker-inl.h b/include/spdlog/details/periodic_worker-inl.h index 520a2b33..9960d51f 100644 --- a/include/spdlog/details/periodic_worker-inl.h +++ b/include/spdlog/details/periodic_worker-inl.h @@ -16,10 +16,10 @@ SPDLOG_INLINE periodic_worker::~periodic_worker() if (worker_thread_.joinable()) { { - std::lock_guard lock(mutex_); + std::unique_lock lock(mutex_); active_ = false; + cv_.notify_one(); } - cv_.notify_one(); worker_thread_.join(); } }