mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2025-07-03 16:25:35 +00:00
Common: Make TID work on Windows
This commit is contained in:
parent
f1148ed1c4
commit
cf08dee84f
@ -114,7 +114,13 @@ std::string ThreadName(bool DebugModeOverride) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RegisterThread(const std::string& str) {
|
void RegisterThread(const std::string& str) {
|
||||||
beammp_debug("Thread \"" + str + "\" is TID " + std::to_string(gettid()));
|
std::string ThreadId;
|
||||||
|
#ifdef WIN32
|
||||||
|
ThreadId = std::to_string(GetCurrentThreadId());
|
||||||
|
#else
|
||||||
|
ThreadId = std::to_string(gettid());
|
||||||
|
#endif
|
||||||
|
beammp_debug("Thread \"" + str + "\" is TID " + ThreadId);
|
||||||
auto Lock = std::unique_lock(ThreadNameMapMutex);
|
auto Lock = std::unique_lock(ThreadNameMapMutex);
|
||||||
threadNameMap[std::this_thread::get_id()] = str;
|
threadNameMap[std::this_thread::get_id()] = str;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user