add mutex to scopedmemmap

This commit is contained in:
Xiao YiFang 2022-06-19 13:26:41 +08:00
parent 3c02fb7499
commit 4edd3b3987
2 changed files with 16 additions and 9 deletions

View file

@ -807,6 +807,7 @@ void FTSResultsRequest::combinedIndexSearch( BtreeIndexing::BtreeIndex & ftsInde
{
if( Utils::AtomicInt::loadAcquire( isCancelled ) )
{
Mutex::Lock _( dataMutex );
sets << tmp;
return;
}

24
mdx.cc
View file

@ -173,17 +173,23 @@ public:
return false;
}
ScopedMemMap compressed( mddFile, indexEntry.compressedBlockPos, indexEntry.compressedBlockSize );
if ( !compressed.startAddress() )
{
return false;
}
QByteArray decompressed;
if ( !MdictParser::parseCompressedBlock( indexEntry.compressedBlockSize, ( char * )compressed.startAddress(),
indexEntry.decompressedBlockSize, decompressed ) )
{
return false;
Mutex::Lock _( idxMutex );
ScopedMemMap compressed( mddFile, indexEntry.compressedBlockPos, indexEntry.compressedBlockSize );
if( !compressed.startAddress() )
{
return false;
}
if( !MdictParser::parseCompressedBlock( indexEntry.compressedBlockSize,
(char *)compressed.startAddress(),
indexEntry.decompressedBlockSize,
decompressed ) )
{
return false;
}
}
result.resize( indexEntry.recordSize );