mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-05 00:42:48 +00:00
safe save backup shutdown
replaced exit by quick_exit
This commit is contained in:
parent
9fa5014d16
commit
33cd65281d
@ -143,6 +143,15 @@ void StartThread() {
|
||||
LOG_DEBUG(Lib_SaveData, "Starting backup thread");
|
||||
g_backup_status = WorkerStatus::Waiting;
|
||||
g_backup_thread = std::jthread{BackupThreadBody};
|
||||
static std::once_flag flag;
|
||||
std::call_once(flag, [] {
|
||||
std::at_quick_exit([] {
|
||||
StopThread();
|
||||
while (GetWorkerStatus() != WorkerStatus::NotStarted) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
void StopThread() {
|
||||
@ -150,12 +159,12 @@ void StopThread() {
|
||||
return;
|
||||
}
|
||||
LOG_DEBUG(Lib_SaveData, "Stopping backup thread");
|
||||
g_backup_status = WorkerStatus::Stopping;
|
||||
{
|
||||
std::scoped_lock lk{g_backup_queue_mutex};
|
||||
g_backup_queue.emplace_back(BackupRequest{});
|
||||
}
|
||||
g_backup_thread_semaphore.release();
|
||||
g_backup_status = WorkerStatus::Stopping;
|
||||
}
|
||||
|
||||
bool NewRequest(OrbisUserServiceUserId user_id, std::string_view title_id,
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "core/libraries/ngs2/ngs2.h"
|
||||
#include "core/libraries/np_trophy/np_trophy.h"
|
||||
#include "core/libraries/rtc/rtc.h"
|
||||
#include "core/libraries/save_data/save_backup.h"
|
||||
#include "core/linker.h"
|
||||
#include "core/memory.h"
|
||||
#include "emulator.h"
|
||||
@ -259,7 +260,7 @@ void Emulator::Run(const std::filesystem::path& file, const std::vector<std::str
|
||||
UpdatePlayTime(id);
|
||||
#endif
|
||||
|
||||
std::exit(0);
|
||||
std::quick_exit(0);
|
||||
}
|
||||
|
||||
void Emulator::LoadSystemModules(const std::string& game_serial) {
|
||||
|
Loading…
Reference in New Issue
Block a user