Core: Wait for background CPU load on exit.

This prevents crashes when exiting a game while loading is still in
progress.  See #11516.
This commit is contained in:
Unknown W. Brackets committed 2018-11-01 21:29:34 -07:00
1 parent 5ea935f4bf
commit 670e207c57
5 files changed
+41 -1

No files matched your search

+14
View File
@@ -82,6 +82,9 @@ ParamSFOData g_paramSFO;
static GlobalUIState globalUIState;
static CoreParameter coreParameter;
static FileLoader *loadedFile;
// For background loading thread.
static std::mutex loadingLock;
// For loadingReason updates.
static std::mutex loadingReasonLock;
static std::string loadingReason;
@@ -255,7 +258,18 @@ void CPU_Init() {
}
}
PSP_LoadingLock::PSP_LoadingLock() {
loadingLock.lock();
}
PSP_LoadingLock::~PSP_LoadingLock() {
loadingLock.unlock();
}
void CPU_Shutdown() {
// Since we load on a background thread, wait for startup to complete.
PSP_LoadingLock lock;
if (g_Config.bAutoSaveSymbolMap) {
host->SaveSymbolMap();
}