From d6475a85d747f8ebc274227b835b820a1ba2c0cf Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Sat, 28 Dec 2024 13:55:25 -0600 Subject: [PATCH] refactor --- repertory/librepertory/src/file_manager/open_file.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/repertory/librepertory/src/file_manager/open_file.cpp b/repertory/librepertory/src/file_manager/open_file.cpp index d3dbad7a..a6c836e2 100644 --- a/repertory/librepertory/src/file_manager/open_file.cpp +++ b/repertory/librepertory/src/file_manager/open_file.cpp @@ -663,6 +663,7 @@ void open_file::update_reader(std::size_t chunk) { reader_thread_ = std::make_unique([this]() { unique_recur_mutex_lock lock(rw_mtx_); auto next_chunk{read_chunk_}; + auto read_chunk{read_chunk_}; lock.unlock(); while (not stop_requested_) { @@ -675,6 +676,10 @@ void open_file::update_reader(std::size_t chunk) { continue; } + if (read_chunk != read_chunk_) { + next_chunk = read_chunk = read_chunk_; + } + next_chunk = next_chunk + 1U >= read_state.size() ? 0U : next_chunk + 1U; lock.unlock();