Skip to content

Commit 2169a6f

Browse files
authored
use std::lock_guard instead of std::unique_lock (#3179)
1 parent 271f0f3 commit 2169a6f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: include/spdlog/details/mpmc_blocking_q.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -148,19 +148,19 @@ class mpmc_blocking_queue {
148148
#endif
149149

150150
size_t overrun_counter() {
151-
std::unique_lock<std::mutex> lock(queue_mutex_);
151+
std::lock_guard<std::mutex> lock(queue_mutex_);
152152
return q_.overrun_counter();
153153
}
154154

155155
size_t discard_counter() { return discard_counter_.load(std::memory_order_relaxed); }
156156

157157
size_t size() {
158-
std::unique_lock<std::mutex> lock(queue_mutex_);
158+
std::lock_guard<std::mutex> lock(queue_mutex_);
159159
return q_.size();
160160
}
161161

162162
void reset_overrun_counter() {
163-
std::unique_lock<std::mutex> lock(queue_mutex_);
163+
std::lock_guard<std::mutex> lock(queue_mutex_);
164164
q_.reset_overrun_counter();
165165
}
166166

0 commit comments

Comments
 (0)