Add customizable per-platform affinity for content and pool threads

This commit is contained in:
Wojtek Figat
2025-07-29 10:41:41 +02:00
parent 17c0892ff1
commit 99323c1d2f
4 changed files with 27 additions and 10 deletions

View File

@@ -129,17 +129,17 @@ bool ContentService::Init()
LOG(Info, "Creating {0} content loading threads...", count);
MainLoadThread = New<LoadingThread>();
ThisLoadThread = MainLoadThread;
LoadThreads.EnsureCapacity(count);
LoadThreads.Resize(count);
for (int32 i = 0; i < count; i++)
{
auto thread = New<LoadingThread>();
LoadThreads[i] = thread;
if (thread->Start(String::Format(TEXT("Load Thread {0}"), i)))
{
LOG(Fatal, "Cannot spawn content thread {0}/{1}", i, count);
Delete(thread);
return true;
}
LoadThreads.Add(thread);
}
return false;
@@ -339,6 +339,9 @@ int32 LoadingThread::Run()
return -1;
}
#endif
#ifdef LOADING_THREAD_AFFINITY_MASK
Platform::SetThreadAffinityMask(LOADING_THREAD_AFFINITY_MASK(LoadThreads.Find(this)));
#endif
ContentLoadTask* task;
ThisLoadThread = this;