aboutsummaryrefslogtreecommitdiffstats
path: root/storageframework
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@oath.com>2019-01-09 09:46:38 +0000
committerTor Brede Vekterli <vekterli@oath.com>2019-01-09 09:46:38 +0000
commitc5850bb67b84120c92c8ba514dbf0e4084389947 (patch)
tree274adb25eb367727728a74402238ca1534ba08ad /storageframework
parentc3fb1b2ec9788569990c232dfa1929e50077a4a1 (diff)
Make thread interruption flag atomic
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;