Skip to content

Commit

Permalink
Fix some dataraces from tsan
Browse files Browse the repository at this point in the history
  • Loading branch information
variar committed Apr 11, 2021
1 parent 4aeb691 commit 3001501
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/logdata/src/logdataworker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ void IndexingData::addAll( const QByteArray& block, LineLength length,

if ( !block.isEmpty() ) {
hash_.size += block.size();

const auto& config = Configuration::get();
if ( !config.fastModificationDetection() ) {
hashBuilder_.addData( block.data(), static_cast<size_t>( block.size() ) );
Expand Down Expand Up @@ -444,14 +444,14 @@ void IndexOperation::doIndex( LineOffset initialPosition )

QtConcurrent::run(
&localThreadPool, [this, &file, &ioDuration, gw = std::ref( gateway )] {
QByteArray readBuffer( IndexingBlockSize, Qt::Uninitialized );
BlockData blockData;
while ( !file.atEnd() ) {

if ( interruptRequest_ ) {
break;
}
QByteArray readBuffer( IndexingBlockSize, Qt::Uninitialized );

BlockData blockData;
blockData.first = file.pos();
clock::time_point ioT1 = clock::now();
const auto readBytes = file.read( readBuffer.data(), readBuffer.size() );
Expand Down Expand Up @@ -497,10 +497,10 @@ void IndexOperation::doIndex( LineOffset initialPosition )
return tbb::flow::continue_msg{};
}

guessEncoding( block, state );

IndexingData::MutateAccessor scopedAccessor{ &indexing_data_ };

guessEncoding( block, state );

if ( !block.isEmpty() ) {
const auto line_positions = parseDataBlock( block_beginning, block, state );
auto max_length = state.max_length;
Expand Down
2 changes: 1 addition & 1 deletion src/utils/include/synchronization.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <absl/synchronization/mutex.h>

using Lock = absl::Mutex;
using ScopedLock = absl::MutexLock;
using ScopedLock = absl::WriterMutexLock;
using ScopedReaderLock = absl::ReaderMutexLock;

using RecursiveLock = std::recursive_mutex;
Expand Down

0 comments on commit 3001501

Please sign in to comment.