This commit is contained in:
2025-02-21 19:59:20 -06:00
parent 1c48b963a6
commit f33d8ff308

View File

@@ -367,10 +367,12 @@ void ring_buffer_base::update_position(std::size_t count, bool is_forward) {
if (is_forward ? (ring_pos_ + count) <= ring_end_
: (ring_pos_ - count) >= ring_begin_) {
ring_pos_ += is_forward ? count : -count;
} else {
chunk_notify_.notify_all();
return;
}
auto delta = is_forward ? count - (ring_end_ - ring_pos_)
: count - (ring_pos_ - ring_begin_);
if (delta >= read_state_.size()) {
read_state_.set(0U, read_state_.size(), false);
ring_pos_ += is_forward ? count : -count;
@@ -389,7 +391,6 @@ void ring_buffer_base::update_position(std::size_t count, bool is_forward) {
ring_end_ =
std::min(total_chunks_ - 1U, ring_begin_ + read_state_.size() - 1U);
}
chunk_notify_.notify_all();
}