mirror of
https://github.com/OpenEmu/PCSX2-Core.git
synced 2025-11-01 11:07:36 +00:00
Fixup Wait code for Race condition on load state
This commit is contained in:
@@ -53,7 +53,7 @@
|
||||
#include <OpenGL/gl3ext.h>
|
||||
|
||||
static bool ExitRequested = false;
|
||||
static bool LoadingSaveState = false;
|
||||
static bool WaitRequested = false;
|
||||
static bool isExecuting = false;
|
||||
|
||||
bool renderswitch = false;
|
||||
@@ -342,7 +342,7 @@ static NSString *binCueFix(NSString *path)
|
||||
continue;
|
||||
|
||||
case VMState::Running:
|
||||
if (!LoadingSaveState) {
|
||||
if (!WaitRequested) {
|
||||
isExecuting = true;
|
||||
VMManager::Execute();
|
||||
isExecuting = false;
|
||||
@@ -447,12 +447,12 @@ static NSString *binCueFix(NSString *path)
|
||||
return;
|
||||
}
|
||||
|
||||
LoadingSaveState = true;
|
||||
WaitRequested = true;
|
||||
while(isExecuting)
|
||||
usleep(50);
|
||||
|
||||
bool success = VMManager::LoadState(fileName.fileSystemRepresentation);
|
||||
LoadingSaveState = false;
|
||||
WaitRequested = false;
|
||||
|
||||
block(success, success ? nil : [NSError errorWithDomain:OEGameCoreErrorDomain code:OEGameCoreCouldNotLoadStateError userInfo:@{NSLocalizedDescriptionKey : @"PCSX2 Could not load the current state.",NSFilePathErrorKey: fileName}]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user