From 5478d6c099e76fe070703cc5383cba7b91468b0f Mon Sep 17 00:00:00 2001 From: Anthony Towns Date: Tue, 11 Feb 2020 16:50:22 +1000 Subject: logging: thread safety annotations Adds LockGuard helper in threadsafety.h to replace lock_guard when LOCK(Mutex) isn't available for use. --- src/logging.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/logging.cpp') diff --git a/src/logging.cpp b/src/logging.cpp index eb9da06d9b..8ec05624ff 100644 --- a/src/logging.cpp +++ b/src/logging.cpp @@ -41,7 +41,7 @@ static int FileWriteStr(const std::string &str, FILE *fp) bool BCLog::Logger::StartLogging() { - std::lock_guard scoped_lock(m_cs); + LockGuard scoped_lock(m_cs); assert(m_buffering); assert(m_fileout == nullptr); @@ -80,7 +80,7 @@ bool BCLog::Logger::StartLogging() void BCLog::Logger::DisconnectTestLogger() { - std::lock_guard scoped_lock(m_cs); + LockGuard scoped_lock(m_cs); m_buffering = true; if (m_fileout != nullptr) fclose(m_fileout); m_fileout = nullptr; @@ -246,7 +246,7 @@ namespace BCLog { void BCLog::Logger::LogPrintStr(const std::string& str) { - std::lock_guard scoped_lock(m_cs); + LockGuard scoped_lock(m_cs); std::string str_prefixed = LogEscapeMessage(str); if (m_log_threadnames && m_started_new_line) { -- cgit v1.2.3