Fix another race condition with multithreading.

It's possible that after it's marked completed, the CPU will grab it to
enqueue.  This actually happened to mean with decent reproducibility.
This commit is contained in:
Unknown W. Brackets 2014-05-03 18:40:27 -07:00
parent 2b50fcb016
commit 984bb31709

View File

@ -663,8 +663,12 @@ void GPUCommon::ProcessDLQueueInternal() {
return;
} else {
easy_guard guard(listLock);
// At the end, we can remove it from the queue and continue.
dlQueue.erase(std::remove(dlQueue.begin(), dlQueue.end(), listIndex), dlQueue.end());
// Some other list could've taken the spot while we dilly-dallied around.
if (l.state != PSP_GE_DL_STATE_QUEUED) {
// At the end, we can remove it from the queue and continue.
dlQueue.erase(std::remove(dlQueue.begin(), dlQueue.end(), listIndex), dlQueue.end());
}
UpdateTickEstimate(std::max(busyTicks, startingTicks + cyclesExecuted));
}
}