Ensure ThreadMap is locked on modification

This commit is contained in:
Jack Andersen 2017-01-16 15:19:06 -10:00
parent f601125b22
commit 362499716c
1 changed files with 2 additions and 0 deletions

View File

@ -48,7 +48,9 @@ static Module Log("logvisor");
static std::unordered_map<std::thread::id, const char*> ThreadMap; static std::unordered_map<std::thread::id, const char*> ThreadMap;
void RegisterThreadName(const char* name) void RegisterThreadName(const char* name)
{ {
auto lk = LockLog();
ThreadMap[std::this_thread::get_id()] = name; ThreadMap[std::this_thread::get_id()] = name;
lk.unlock();
#if __APPLE__ #if __APPLE__
pthread_setname_np(name); pthread_setname_np(name);
#elif __linux__ #elif __linux__