From eb9719cc8b9a308654ccd2c3bce8a7047b6e2a1a Mon Sep 17 00:00:00 2001 From: Nicolas James Date: Wed, 8 Apr 2026 00:56:40 +1000 Subject: Refactor storing submissions into FrameSpan class, reduce AntiLag thread contention --- src/frame_span.cc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/frame_span.cc (limited to 'src/frame_span.cc') diff --git a/src/frame_span.cc b/src/frame_span.cc new file mode 100644 index 0000000..732d6f3 --- /dev/null +++ b/src/frame_span.cc @@ -0,0 +1,24 @@ +#include "frame_span.hh" + +namespace low_latency { + +FrameSpan::FrameSpan(std::shared_ptr handle) + : head_handle(std::move(handle)) { + assert(this->head_handle); // Must not be null +} + +FrameSpan::~FrameSpan() {} + +void FrameSpan::update(std::shared_ptr handle) { + this->tail_handle = std::move(handle); +} + +void FrameSpan::await_completed() const { + if (this->tail_handle) { + this->tail_handle->await_end(); + return; + } + this->head_handle->await_end(); +} + +} // namespace low_latency \ No newline at end of file -- cgit v1.2.3