mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-12-22 22:58:52 +00:00
Merge pull request #1696
6ea3e3cc
Fix race in setThreadName/getThreadName (Lee Clagett)
This commit is contained in:
commit
d1b7ad3f1a
2
external/easylogging++/easylogging++.h
vendored
2
external/easylogging++/easylogging++.h
vendored
@ -3988,10 +3988,12 @@ inline void FUNCTION_NAME(const T&);
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setThreadName(const std::string &name) {
|
void setThreadName(const std::string &name) {
|
||||||
|
const base::threading::ScopedLock scopedLock(lock());
|
||||||
m_threadNames[base::threading::getCurrentThreadId()] = name;
|
m_threadNames[base::threading::getCurrentThreadId()] = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getThreadName(const std::string& name) {
|
std::string getThreadName(const std::string& name) {
|
||||||
|
const base::threading::ScopedLock scopedLock(lock());
|
||||||
std::map<std::string, std::string>::const_iterator it = m_threadNames.find(name);
|
std::map<std::string, std::string>::const_iterator it = m_threadNames.find(name);
|
||||||
if (it == m_threadNames.end())
|
if (it == m_threadNames.end())
|
||||||
return name;
|
return name;
|
||||||
|
Loading…
Reference in New Issue
Block a user