Common: Make TID work on Windows

This commit is contained in:
Lion Kortlepel 2021-11-19 13:12:27 +01:00
parent f1148ed1c4
commit cf08dee84f
No known key found for this signature in database
GPG Key ID: 4322FF2B4C71259B

View File

@ -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;
} }