diff options
author | bunnei <bunneidev@gmail.com> | 2022-10-15 09:48:28 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2022-10-19 04:13:35 +0200 |
commit | 638fa6170a8a4c36ffa644055e683a7e50aa7ae5 (patch) | |
tree | 42d24dd017358235db295b512d3be2228b9b95d5 /src/core/core_timing.cpp | |
parent | core: core_timing: Remove unused IsHostTiming. (diff) | |
download | yuzu-638fa6170a8a4c36ffa644055e683a7e50aa7ae5.tar yuzu-638fa6170a8a4c36ffa644055e683a7e50aa7ae5.tar.gz yuzu-638fa6170a8a4c36ffa644055e683a7e50aa7ae5.tar.bz2 yuzu-638fa6170a8a4c36ffa644055e683a7e50aa7ae5.tar.lz yuzu-638fa6170a8a4c36ffa644055e683a7e50aa7ae5.tar.xz yuzu-638fa6170a8a4c36ffa644055e683a7e50aa7ae5.tar.zst yuzu-638fa6170a8a4c36ffa644055e683a7e50aa7ae5.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/core_timing.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp index 2afb2696c..0e7b5f943 100644 --- a/src/core/core_timing.cpp +++ b/src/core/core_timing.cpp @@ -41,15 +41,7 @@ CoreTiming::CoreTiming() : clock{Common::CreateBestMatchingClock(Hardware::BASE_CLOCK_RATE, Hardware::CNTFREQ)} {} CoreTiming::~CoreTiming() { - paused = true; - shutting_down = true; - pause_event.Set(); - event.Set(); - if (timer_thread) { - timer_thread->join(); - } - timer_thread.reset(); - has_started = false; + Reset(); } void CoreTiming::ThreadEntry(CoreTiming& instance) { @@ -63,6 +55,7 @@ void CoreTiming::ThreadEntry(CoreTiming& instance) { } void CoreTiming::Initialize(std::function<void()>&& on_thread_init_) { + Reset(); on_thread_init = std::move(on_thread_init_); event_fifo_id = 0; shutting_down = false; @@ -304,6 +297,18 @@ void CoreTiming::ThreadLoop() { } } +void CoreTiming::Reset() { + paused = true; + shutting_down = true; + pause_event.Set(); + event.Set(); + if (timer_thread) { + timer_thread->join(); + } + timer_thread.reset(); + has_started = false; +} + std::chrono::nanoseconds CoreTiming::GetGlobalTimeNs() const { if (is_multicore) { return clock->GetTimeNS(); |