From 6ea3e3ccc7c0e6cd77a2f5c97df968518e734bd7 Mon Sep 17 00:00:00 2001 From: Lee Clagett Date: Tue, 7 Feb 2017 21:33:26 -0500 Subject: [PATCH] Fix race in setThreadName/getThreadName --- external/easylogging++/easylogging++.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/external/easylogging++/easylogging++.h b/external/easylogging++/easylogging++.h index d2815266..64bfa58c 100644 --- a/external/easylogging++/easylogging++.h +++ b/external/easylogging++/easylogging++.h @@ -3988,10 +3988,12 @@ inline void FUNCTION_NAME(const T&); } void setThreadName(const std::string &name) { + const base::threading::ScopedLock scopedLock(lock()); m_threadNames[base::threading::getCurrentThreadId()] = name; } std::string getThreadName(const std::string& name) { + const base::threading::ScopedLock scopedLock(lock()); std::map::const_iterator it = m_threadNames.find(name); if (it == m_threadNames.end()) return name;