UI: Cancel loaders on shutdown.

Improves backend switching / locking / etc. performance when the recent
list has games that aren't currently available.

Also, remove unnecessary duplicate gameinfo flush on EGL loop shutdown.
Already happens in NativeShutdownGraphics().
This commit is contained in:
Unknown W. Brackets
2017-12-09 16:48:38 -08:00
parent ee5b68f1fc
commit 2943bbdbfd
3 changed files with 14 additions and 2 deletions
+13
View File
@@ -674,6 +674,8 @@ void GameInfoCache::Init() {
}
void GameInfoCache::Shutdown() {
CancelAll();
if (gameInfoWQ_) {
StopProcessingWorkQueue(gameInfoWQ_);
delete gameInfoWQ_;
@@ -682,6 +684,8 @@ void GameInfoCache::Shutdown() {
}
void GameInfoCache::Clear() {
CancelAll();
if (gameInfoWQ_) {
gameInfoWQ_->Flush();
gameInfoWQ_->WaitUntilDone();
@@ -689,6 +693,15 @@ void GameInfoCache::Clear() {
info_.clear();
}
void GameInfoCache::CancelAll() {
for (auto info : info_) {
FileLoader *fl = info.second->GetFileLoader();
if (fl) {
fl->Cancel();
}
}
}
void GameInfoCache::FlushBGs() {
for (auto iter = info_.begin(); iter != info_.end(); iter++) {
std::lock_guard<std::mutex> lock(iter->second->lock);