Explorar el Código

Ensure work item gets inserted last into the queue if no other option. Closes #1656.

Lasse Öörni hace 9 años
padre
commit
a8f1fbc7ed
Se han modificado 1 ficheros con 6 adiciones y 0 borrados
  1. 6 0
      Source/Urho3D/Core/WorkQueue.cpp

+ 6 - 0
Source/Urho3D/Core/WorkQueue.cpp

@@ -147,14 +147,20 @@ void WorkQueue::AddWorkItem(SharedPtr<WorkItem> item)
         queue_.Push(item);
     else
     {
+        bool inserted = false;
+
         for (List<WorkItem*>::Iterator i = queue_.Begin(); i != queue_.End(); ++i)
         {
             if ((*i)->priority_ <= item->priority_)
             {
                 queue_.Insert(i, item);
+                inserted = true;
                 break;
             }
         }
+
+        if (!inserted)
+            queue_.Push(item);
     }
 
     if (threads_.Size())