diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2020-02-10 20:02:04 +0100 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2020-06-18 22:29:22 +0200 |
commit | 49a7e0984a1210832b8be24433a95711c7ce029b (patch) | |
tree | 73cfc4456382895f75b6f56f5f1bb96501929de9 /src/core/host_timing.h | |
parent | Common/Tests: Address Feedback (diff) | |
download | yuzu-49a7e0984a1210832b8be24433a95711c7ce029b.tar yuzu-49a7e0984a1210832b8be24433a95711c7ce029b.tar.gz yuzu-49a7e0984a1210832b8be24433a95711c7ce029b.tar.bz2 yuzu-49a7e0984a1210832b8be24433a95711c7ce029b.tar.lz yuzu-49a7e0984a1210832b8be24433a95711c7ce029b.tar.xz yuzu-49a7e0984a1210832b8be24433a95711c7ce029b.tar.zst yuzu-49a7e0984a1210832b8be24433a95711c7ce029b.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/host_timing.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/host_timing.h b/src/core/host_timing.h index 679fcf491..cd44b308c 100644 --- a/src/core/host_timing.h +++ b/src/core/host_timing.h @@ -103,6 +103,9 @@ public: /// Returns current time in nanoseconds. std::chrono::nanoseconds GetGlobalTimeNs() const; + /// Checks for events manually and returns time in nanoseconds for next event, threadsafe. + std::optional<u64> Advance(); + private: struct Event; @@ -110,7 +113,7 @@ private: void ClearPendingEvents(); static void ThreadEntry(CoreTiming& instance); - void Advance(); + void ThreadLoop(); std::unique_ptr<Common::WallClock> clock; @@ -128,6 +131,7 @@ private: std::shared_ptr<EventType> ev_lost; Common::Event event{}; Common::SpinLock basic_lock{}; + Common::SpinLock advance_lock{}; std::unique_ptr<std::thread> timer_thread; std::atomic<bool> paused{}; std::atomic<bool> paused_set{}; |