mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-12-03 03:03:50 +01:00
Prevent a possible race condition in save/load.
This commit is contained in:
1 parent
e3c6876365
commit
01d3dcdc99
2 files changed
+4
No files matched your search
@@ -584,6 +584,7 @@ int PSPSaveDialog::Update(int animSpeed)
|
||||
memset(&request, 0, sizeof(request));
|
||||
Memory::Memcpy(&request, requestAddr, size);
|
||||
Memory::Memcpy(&originalRequest, requestAddr, size);
|
||||
lock_guard guard(paramLock);
|
||||
param.SetPspParam(&request);
|
||||
}
|
||||
|
||||
@@ -990,6 +991,7 @@ int PSPSaveDialog::Update(int animSpeed)
|
||||
}
|
||||
|
||||
void PSPSaveDialog::ExecuteIOAction() {
|
||||
lock_guard guard(paramLock);
|
||||
switch (display) {
|
||||
case DS_LOAD_LOADING:
|
||||
if (param.Load(param.GetPspParam(), GetSelectedSaveDirName(), currentSelectedSave)) {
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "native/thread/thread.h"
|
||||
#include "native/base/mutex.h"
|
||||
#include "Core/Dialog/PSPDialog.h"
|
||||
#include "Core/Dialog/SavedataParam.h"
|
||||
|
||||
@@ -150,6 +151,7 @@ private:
|
||||
};
|
||||
|
||||
std::thread *ioThread;
|
||||
recursive_mutex paramLock;
|
||||
volatile SaveIOStatus ioThreadStatus;
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user