mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-07-22 12:45:44 +00:00
Core/HostTiming: Allow events to be advanced manually.
This commit is contained in:
parent
564713fb46
commit
e7f5b1f1d3
4 changed files with 47 additions and 31 deletions
|
@ -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{};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue