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(); } }