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();