diff options
author | Anthony Towns <aj@erisian.com.au> | 2020-02-11 16:50:22 +1000 |
---|---|---|
committer | Anthony Towns <aj@erisian.com.au> | 2020-05-27 01:31:51 +1000 |
commit | 5478d6c099e76fe070703cc5383cba7b91468b0f (patch) | |
tree | ec02170ef4e628dad3bbec5d7c1199671c5c4c23 /src/logging.cpp | |
parent | e685ca19928eec4e687c66f5edfcfff085a42c27 (diff) |
logging: thread safety annotations
Adds LockGuard helper in threadsafety.h to replace lock_guard<mutex>
when LOCK(Mutex) isn't available for use.
Diffstat (limited to 'src/logging.cpp')
-rw-r--r-- | src/logging.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
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<std::mutex> 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<std::mutex> 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<std::mutex> scoped_lock(m_cs); + LockGuard scoped_lock(m_cs); std::string str_prefixed = LogEscapeMessage(str); if (m_log_threadnames && m_started_new_line) { |