Skip to content

Commit

Permalink
Main: fix processMainThreadTasks() waiting logic
Browse files Browse the repository at this point in the history
Co-authored-by: Guillaume Jacob <[email protected]>
  • Loading branch information
guillaume-jcb and Guillaume Jacob authored Sep 9, 2023
1 parent 15631ca commit 84645fd
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions OgreMain/src/OgreWorkQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,20 +173,17 @@ namespace Ogre {
unsigned long msCurrent = 0;

// keep going until we run out of responses or out of time
while(true)
while(!mMainThreadTasks.empty())
{
if(!mMainThreadTasks.empty())
std::function<void()> task;
{
std::function<void()> task;
{
OGRE_WQ_LOCK_MUTEX(mResponseMutex);
LogManager::getSingleton().stream(LML_TRIVIAL)
<< "DefaultWorkQueueBase('" << mName << "') - PROCESS_MAIN_TASK";
task = std::move(mMainThreadTasks.front());
mMainThreadTasks.pop_front();
}
task();
OGRE_WQ_LOCK_MUTEX(mResponseMutex);
LogManager::getSingleton().stream(LML_TRIVIAL)
<< "DefaultWorkQueueBase('" << mName << "') - PROCESS_MAIN_TASK";
task = std::move(mMainThreadTasks.front());
mMainThreadTasks.pop_front();
}
task();

// time limit
if (mResposeTimeLimitMS)
Expand Down

0 comments on commit 84645fd

Please sign in to comment.