mirror of
https://github.com/libretro/Mesen.git
synced 2025-02-24 18:41:48 +00:00
Fixed 1 second delay when changing game
This commit is contained in:
parent
41c59b164a
commit
4d2391b90c
@ -22,7 +22,10 @@ AutoSaveManager::AutoSaveManager()
|
||||
} else {
|
||||
_timer.Reset();
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::duration<int, std::milli>(1000));
|
||||
|
||||
if(!_stopThread) {
|
||||
_signal.Wait(1000);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -30,5 +33,6 @@ AutoSaveManager::AutoSaveManager()
|
||||
AutoSaveManager::~AutoSaveManager()
|
||||
{
|
||||
_stopThread = true;
|
||||
_signal.Signal();
|
||||
_autoSaveThread.join();
|
||||
}
|
||||
|
@ -2,13 +2,16 @@
|
||||
#include "stdafx.h"
|
||||
#include <thread>
|
||||
#include "../Utilities/Timer.h"
|
||||
#include "../Utilities/AutoResetEvent.h"
|
||||
|
||||
class AutoSaveManager
|
||||
{
|
||||
private:
|
||||
const uint32_t _autoSaveSlot = 8;
|
||||
std::thread _autoSaveThread;
|
||||
|
||||
atomic<bool> _stopThread;
|
||||
AutoResetEvent _signal;
|
||||
Timer _timer;
|
||||
|
||||
public:
|
||||
|
Loading…
x
Reference in New Issue
Block a user