From 2169a6f6ae5208e181be6184ed3f5121095fc280 Mon Sep 17 00:00:00 2001 From: Leslie Date: Thu, 12 Sep 2024 03:18:51 +0800 Subject: [PATCH] use std::lock_guard instead of std::unique_lock (#3179) --- include/spdlog/details/mpmc_blocking_q.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/spdlog/details/mpmc_blocking_q.h b/include/spdlog/details/mpmc_blocking_q.h index 5a474bf3..5848cca8 100644 --- a/include/spdlog/details/mpmc_blocking_q.h +++ b/include/spdlog/details/mpmc_blocking_q.h @@ -148,19 +148,19 @@ public: #endif size_t overrun_counter() { - std::unique_lock lock(queue_mutex_); + std::lock_guard lock(queue_mutex_); return q_.overrun_counter(); } size_t discard_counter() { return discard_counter_.load(std::memory_order_relaxed); } size_t size() { - std::unique_lock lock(queue_mutex_); + std::lock_guard lock(queue_mutex_); return q_.size(); } void reset_overrun_counter() { - std::unique_lock lock(queue_mutex_); + std::lock_guard lock(queue_mutex_); q_.reset_overrun_counter(); }