Skip to content

Commit d7e4f03

Browse files
committed
Add thread ID and process ID logging
1 parent 9be9c9a commit d7e4f03

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Client/loader/MainFunctions.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,6 +1144,7 @@ int LaunchGame(SString strCmdLine)
11441144
}
11451145

11461146
WriteDebugEvent(SString("Loader - Process created: %s %s", *strGTAEXEPath, *GetApplicationSetting("serial")));
1147+
WriteDebugEvent(SString("Loader - Process ID: %lu, Thread ID: %lu\n", piLoadee.dwProcessId, piLoadee.dwThreadId));
11471148

11481149
// Inject the core into GTA
11491150
SetDllDirectory(strMtaDir);

Shared/sdk/SharedUtil.Misc.hpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1320,7 +1320,15 @@ DWORD SharedUtil::GetMainThreadId()
13201320
bool SharedUtil::IsMainThread()
13211321
{
13221322
#ifdef WIN32
1323-
return GetMainThreadId() == GetCurrentThreadId();
1323+
DWORD mainThreadID = GetMainThreadId();
1324+
DWORD currentThreadID = GetCurrentThreadId();
1325+
1326+
#ifdef MTA_CLIENT
1327+
if (mainThreadID != currentThreadID)
1328+
WriteDebugEvent(SString("IsMainThread() - Main: %lu, Current: %lu\n", mainThreadID, currentThreadID));
1329+
#endif
1330+
1331+
return mainThreadID == currentThreadID;
13241332
#else
13251333
static pthread_t dwMainThread = pthread_self();
13261334
return pthread_equal(pthread_self(), dwMainThread) != 0;

0 commit comments

Comments
 (0)