mirror of https://github.com/AxioDL/logvisor.git
Ensure ThreadMap is locked on modification
This commit is contained in:
parent
f601125b22
commit
362499716c
|
@ -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__
|
||||||
|
|
Loading…
Reference in New Issue