HostTiming: Pause the hardware clock on pause.

This commit is contained in:
Fernando Sahmkow 2020-02-25 12:28:55 -04:00
parent 6bf137a0e8
commit 18dcb09342
7 changed files with 23 additions and 1 deletions

View file

@ -137,8 +137,8 @@ struct System::Impl {
ResultStatus Pause() {
status = ResultStatus::Success;
kernel.Suspend(true);
core_timing.SyncPause(true);
kernel.Suspend(true);
cpu_manager.Pause(true);
return status;

View file

@ -77,6 +77,9 @@ void CoreTiming::SyncPause(bool is_paused) {
return;
}
Pause(is_paused);
if (!is_paused) {
pause_event.Set();
}
event.Set();
while (paused_set != is_paused)
;
@ -197,6 +200,9 @@ void CoreTiming::ThreadLoop() {
wait_set = false;
}
paused_set = true;
clock->Pause(true);
pause_event.Wait();
clock->Pause(false);
}
}

View file

@ -136,6 +136,7 @@ private:
std::shared_ptr<EventType> ev_lost;
Common::Event event{};
Common::Event pause_event{};
Common::SpinLock basic_lock{};
Common::SpinLock advance_lock{};
std::unique_ptr<std::thread> timer_thread;