From cf08dee84f226fd32b10ecc534f2fef3f88b11d5 Mon Sep 17 00:00:00 2001 From: Lion Kortlepel Date: Fri, 19 Nov 2021 13:12:27 +0100 Subject: [PATCH] Common: Make TID work on Windows --- src/Common.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Common.cpp b/src/Common.cpp index b1641a9..6ea929f 100644 --- a/src/Common.cpp +++ b/src/Common.cpp @@ -114,7 +114,13 @@ std::string ThreadName(bool DebugModeOverride) { } 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); threadNameMap[std::this_thread::get_id()] = str; }