Skip to content

Commit

Permalink
Check for cancellation after mutex
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinTF committed Nov 22, 2024
1 parent 5f28e83 commit 246b977
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/index/CompressedRelation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ CompressedRelationReader::asyncParallelBlockGenerator(
auto readAndDecompressBlock = [&]()
-> std::optional<
std::pair<size_t, std::optional<DecompressedBlockAndMetadata>>> {
cancellationHandle->throwIfCancelled();
std::unique_lock lock{blockIteratorMutex};
cancellationHandle->throwIfCancelled();
if (blockMetadataIterator == endBlock) {
return std::nullopt;
}
Expand All @@ -102,8 +102,10 @@ CompressedRelationReader::asyncParallelBlockGenerator(
CompressedBlock compressedBlock =
readCompressedBlockFromFile(blockMetadata, columnIndices);
lock.unlock();
cancellationHandle->throwIfCancelled();
auto decompressedBlockAndMetadata = decompressAndPostprocessBlock(
compressedBlock, blockMetadata.numRows_, scanConfig, blockMetadata);
cancellationHandle->throwIfCancelled();
return std::pair{myIndex,
std::optional{std::move(decompressedBlockAndMetadata)}};
};
Expand Down

0 comments on commit 246b977

Please sign in to comment.