From f30d128c69cbd663d3539bc2e41950fc2191a632 Mon Sep 17 00:00:00 2001 From: Giulio Formenti Date: Wed, 25 Dec 2024 19:50:12 -0500 Subject: [PATCH] Update reads.cpp --- src/reads.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/reads.cpp b/src/reads.cpp index 7e997ce..24cb976 100644 --- a/src/reads.cpp +++ b/src/reads.cpp @@ -739,13 +739,15 @@ void InReads::writeToStream() { std::vector,uint32_t>> readBatchesCpy; - while (streamOutput || batchCounter-1 < readBatches.size()) { + while (streamOutput || batchCounter < readBatches.size()) { { std::unique_lock lck(mtx); writerMutexCondition.wait(lck, [this, batchCounter] { return readBatches.size()>batchCounter; }); + if (!streamOutput || batchCounter == readBatches.size()) + return; readBatchesCpy = {readBatches.begin() + batchCounter, readBatches.end()}; }