[GPU] Short circuit command processor waits if an exit is requested.

This commit is contained in:
DrChat 2017-12-18 17:23:14 -06:00
parent d98344f99b
commit 29c5fb8022
1 changed files with 7 additions and 1 deletions

View File

@ -338,7 +338,7 @@ void CommandProcessor::IssueSwap(uint32_t frontbuffer_ptr,
} }
} else { } else {
// Spin until no more pending swap. // Spin until no more pending swap.
while (true) { while (worker_running_) {
{ {
std::lock_guard<std::mutex> lock(swap_state_.mutex); std::lock_guard<std::mutex> lock(swap_state_.mutex);
if (!swap_state_.pending) { if (!swap_state_.pending) {
@ -827,11 +827,17 @@ bool CommandProcessor::ExecutePacketType3_WAIT_REG_MEM(RingBuffer* reader,
} }
xe::threading::SyncMemory(); xe::threading::SyncMemory();
ReturnFromWait(); ReturnFromWait();
if (!worker_running_) {
// Short-circuited exit.
return false;
}
} else { } else {
xe::threading::MaybeYield(); xe::threading::MaybeYield();
} }
} }
} while (!matched); } while (!matched);
return true; return true;
} }