From 5566c5dff4d6430f704aeb66ca45615cb0df0176 Mon Sep 17 00:00:00 2001 From: Nicolas James Date: Wed, 8 Apr 2026 14:04:03 +1000 Subject: Reduce thread contention by introducing an atomic time point class - greatly reduces locking --- src/strategies/low_latency2/swapchain_monitor.hh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/strategies/low_latency2/swapchain_monitor.hh') diff --git a/src/strategies/low_latency2/swapchain_monitor.hh b/src/strategies/low_latency2/swapchain_monitor.hh index a5f8362..28771cf 100644 --- a/src/strategies/low_latency2/swapchain_monitor.hh +++ b/src/strategies/low_latency2/swapchain_monitor.hh @@ -2,8 +2,10 @@ #ifndef SWAPCHAIN_MONITOR_HH_ #define SWAPCHAIN_MONITOR_HH_ +#include "atomic_time_point.hh" #include "frame_span.hh" +#include #include #include @@ -40,12 +42,11 @@ class SwapchainMonitor final { std::mutex mutex{}; std::chrono::microseconds present_delay{}; bool was_low_latency_requested{}; + AtomicTimePoint last_signal_time{}; std::condition_variable_any cv{}; std::jthread monitor_worker{}; - std::optional last_signal_time; - void do_monitor(const std::stop_token stoken); public: -- cgit v1.2.3