diff --git a/Source/Engine/Content/Content.cpp b/Source/Engine/Content/Content.cpp index 48e7b6c1f..6742d3490 100644 --- a/Source/Engine/Content/Content.cpp +++ b/Source/Engine/Content/Content.cpp @@ -1107,11 +1107,21 @@ void Content::WaitForTask(ContentLoadTask* loadingTask, double timeoutInMillisec const double timeoutInSeconds = timeoutInMilliseconds * 0.001; const double startTime = Platform::GetTimeSeconds(); + int32 loopCounter = 0; Task* task = loadingTask; Array> localQueue; #define CHECK_CONDITIONS() (!Engine::ShouldExit() && (timeoutInSeconds <= 0.0 || Platform::GetTimeSeconds() - startTime < timeoutInSeconds)) do { + // Give opportunity for other threads to use the current core + if (loopCounter == 0) + ; // First run is fast + else if (loopCounter < 10) + Platform::Yield(); + else + Platform::Sleep(1); + loopCounter++; + // Try to execute content tasks while (task->IsQueued() && CHECK_CONDITIONS()) {