From d49b648751c0ae90d73cc0dc5b301a668441f6a9 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Tue, 8 Dec 2020 16:35:42 +0100 Subject: [PATCH] RemoteLogger: Use the simpler lock_guard instead of unique_lock --- pdns/remote_logger.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pdns/remote_logger.cc b/pdns/remote_logger.cc index 10101cebda..a6074271c0 100644 --- a/pdns/remote_logger.cc +++ b/pdns/remote_logger.cc @@ -116,7 +116,7 @@ bool RemoteLogger::reconnect() { /* we are now successfully connected, time to take the lock and update the socket */ - std::unique_lock lock(d_mutex); + std::lock_guard lock(d_mutex); d_socket = std::move(newSock); } } @@ -138,7 +138,7 @@ void RemoteLogger::queueData(const std::string& data) throw std::runtime_error("Got a request to write an object of size " + data.size()); } - std::unique_lock lock(d_mutex); + std::lock_guard lock(d_mutex); if (!d_writer.hasRoomFor(data)) { /* not connected, queue is full, just drop */ @@ -198,7 +198,7 @@ try if (connected) { try { /* we don't want to take the lock while trying to reconnect */ - std::unique_lock lock(d_mutex); + std::lock_guard lock(d_mutex); if (d_socket) { // check if it is set /* if flush() returns false, it means that we couldn't flush anything yet either because there is nothing to flush, or because the outgoing TCP -- 2.47.2