threadpool: don't run cancelled ticket

This commit is contained in:
itsmattkc
2021-09-22 18:32:33 -07:00
parent 8f4095019a
commit c15f92320d
+13 -7
View File
@@ -83,15 +83,21 @@ void ThreadPool::RunNext()
RenderTicketPtr ticket = ticket_queue_.front();
ticket_queue_.pop_front();
ThreadPoolThread* thread = available_threads_.front();
available_threads_.pop_front();
// Move ticket to other thread so event processing can occur there
ticket->Start();
ticket->moveToThread(thread);
// Run the ticket in the thread, which actually just calls our virtual function RunTicket
thread->RunTicket(ticket);
if (ticket->IsCancelled()) {
// Finish without doing any more
ticket->Finish();
} else {
ThreadPoolThread* thread = available_threads_.front();
available_threads_.pop_front();
// Move ticket to other thread so event processing can occur there
ticket->moveToThread(thread);
// Run the ticket in the thread, which actually just calls our virtual function RunTicket
thread->RunTicket(ticket);
}
}
}