aboutsummaryrefslogtreecommitdiffstats
path: root/storageframework
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@oath.com>2019-01-15 09:48:44 +0100
committerGitHub <noreply@github.com>2019-01-15 09:48:44 +0100
commit959655d2bd9f743b34c6e5caac21e44de48187e3 (patch)
tree4aba819ffb380484fedf12770fb5b7e8bddc5a04 /storageframework
parent86b4be8b2439880c7e40c157896e1b42caac4b86 (diff)
parent7d1dda33a7b4e1e1727947c0104ed86036a5bef4 (diff)
Merge pull request #8109 from vespa-engine/vekterli/fix-tsan-detected-data-races
Fix some ThreadSanitizer reported data races
Diffstat (limited to 'storageframework')
-rw-r--r--storageframework/src/vespa/storageframework/defaultimplementation/thread/threadimpl.cpp4
-rw-r--r--storageframework/src/vespa/storageframework/defaultimplementation/thread/threadimpl.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadimpl.cpp b/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadimpl.cpp
index b9ccb2d4d9f..7c30944d911 100644
--- a/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadimpl.cpp
+++ b/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadimpl.cpp
@@ -46,7 +46,7 @@ ThreadImpl::run()
bool
ThreadImpl::interrupted() const
{
- return _interrupted;
+ return _interrupted.load(std::memory_order_relaxed);
}
bool
@@ -58,7 +58,7 @@ ThreadImpl::joined() const
void
ThreadImpl::interrupt()
{
- _interrupted = true;
+ _interrupted.store(true, std::memory_order_relaxed);
_thread.stop();
}
diff --git a/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadimpl.h b/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadimpl.h
index 798251f0573..bb89c9167a3 100644
--- a/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadimpl.h
+++ b/storageframework/src/vespa/storageframework/defaultimplementation/thread/threadimpl.h
@@ -42,7 +42,7 @@ class ThreadImpl : public Thread
ThreadProperties _properties;
std::array<AtomicThreadTickData, 3> _tickData;
uint32_t _tickDataPtr;
- bool _interrupted;
+ std::atomic<bool> _interrupted;
bool _joined;
BackendThread _thread;