Skip to content

Commit

Permalink
use std::lock_guard instead of std::unique_lock (#3179)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsehjk authored Sep 11, 2024
1 parent 271f0f3 commit 2169a6f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions include/spdlog/details/mpmc_blocking_q.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,19 +148,19 @@ class mpmc_blocking_queue {
#endif

size_t overrun_counter() {
std::unique_lock<std::mutex> lock(queue_mutex_);
std::lock_guard<std::mutex> 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<std::mutex> lock(queue_mutex_);
std::lock_guard<std::mutex> lock(queue_mutex_);
return q_.size();
}

void reset_overrun_counter() {
std::unique_lock<std::mutex> lock(queue_mutex_);
std::lock_guard<std::mutex> lock(queue_mutex_);
q_.reset_overrun_counter();
}

Expand Down

0 comments on commit 2169a6f

Please sign in to comment.