Add support for running engine with a single-thread only (content, jobs, drawing, physics)
This commit is contained in:
@@ -22,9 +22,16 @@ FLAXENGINE_API bool IsInMainThread()
|
||||
return Globals::MainThreadID == Platform::GetCurrentThreadID();
|
||||
}
|
||||
|
||||
String ThreadPoolTask::ToString() const
|
||||
{
|
||||
return String::Format(TEXT("Thread Pool Task ({0})"), (int32)GetState());
|
||||
}
|
||||
|
||||
#if PLATFORM_THREADS_LIMIT > 1
|
||||
|
||||
namespace ThreadPoolImpl
|
||||
{
|
||||
volatile int64 ExitFlag = 0;
|
||||
volatile intptr ExitFlag = 0;
|
||||
Array<Thread*> Threads;
|
||||
ConcurrentTaskQueue<ThreadPoolTask> Jobs; // Hello Steve!
|
||||
ConditionVariable JobsSignal;
|
||||
@@ -34,11 +41,6 @@ namespace ThreadPoolImpl
|
||||
#endif
|
||||
}
|
||||
|
||||
String ThreadPoolTask::ToString() const
|
||||
{
|
||||
return String::Format(TEXT("Thread Pool Task ({0})"), (int32)GetState());
|
||||
}
|
||||
|
||||
void ThreadPoolTask::Enqueue()
|
||||
{
|
||||
PROFILE_MEM(EngineThreading);
|
||||
@@ -141,3 +143,13 @@ int32 ThreadPool::ThreadProc()
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void ThreadPoolTask::Enqueue()
|
||||
{
|
||||
// Run task on the main thread (fallback when no threading is supported)
|
||||
Execute();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user