diff options
| author | Nicolas James <nj3ahxac@gmail.com> | 2026-04-08 14:04:03 +1000 |
|---|---|---|
| committer | Nicolas James <nj3ahxac@gmail.com> | 2026-04-08 14:04:03 +1000 |
| commit | 5566c5dff4d6430f704aeb66ca45615cb0df0176 (patch) | |
| tree | 523e784bd31d2908b5a7d3c13fdcf46b4ed3a4ab /src/strategies/low_latency2/swapchain_monitor.hh | |
| parent | a67570bc468664627da48b4ebe22c7caad217732 (diff) | |
Reduce thread contention by introducing an atomic time point class - greatly reduces locking
Diffstat (limited to 'src/strategies/low_latency2/swapchain_monitor.hh')
| -rw-r--r-- | src/strategies/low_latency2/swapchain_monitor.hh | 5 |
1 files changed, 3 insertions, 2 deletions
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 <atomic> #include <vulkan/vulkan.h> #include <chrono> @@ -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<std::chrono::steady_clock::time_point> last_signal_time; - void do_monitor(const std::stop_token stoken); public: |
