From: Remi Gacogne Date: Tue, 8 Dec 2020 15:35:42 +0000 (+0100) Subject: RemoteLogger: Use the simpler lock_guard instead of unique_lock X-Git-Tag: rec-4.5.0-alpha1~38^2~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d49b648751c0ae90d73cc0dc5b301a668441f6a9;p=thirdparty%2Fpdns.git RemoteLogger: Use the simpler lock_guard instead of unique_lock --- 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