mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Prevent a possible race condition in save/load.
This commit is contained in:
parent
e3c6876365
commit
01d3dcdc99
2 changed files with 4 additions and 0 deletions
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue