aboutsummaryrefslogtreecommitdiff
path: root/src/threadinterrupt.cpp
diff options
context:
space:
mode:
authorRussell Yanofsky <russ@yanofsky.org>2017-11-08 17:07:40 -0500
committerRussell Yanofsky <russ@yanofsky.org>2018-08-03 07:11:37 -0500
commit9c4dc597ddc66acfd58a945a5ab11f833731abba (patch)
tree65dd64eda8515ccc9245a1b4bb2211d60c620c07 /src/threadinterrupt.cpp
parent1382913e61f5db6ba849b1e261e8aefcd5a1ae68 (diff)
Use LOCK macros for non-recursive locks
Instead of std::unique_lock.
Diffstat (limited to 'src/threadinterrupt.cpp')
-rw-r--r--src/threadinterrupt.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/threadinterrupt.cpp b/src/threadinterrupt.cpp
index 7da4e136ef..1efc6f3114 100644
--- a/src/threadinterrupt.cpp
+++ b/src/threadinterrupt.cpp
@@ -5,6 +5,8 @@
#include <threadinterrupt.h>
+#include <sync.h>
+
CThreadInterrupt::CThreadInterrupt() : flag(false) {}
CThreadInterrupt::operator bool() const
@@ -20,7 +22,7 @@ void CThreadInterrupt::reset()
void CThreadInterrupt::operator()()
{
{
- std::unique_lock<std::mutex> lock(mut);
+ LOCK(mut);
flag.store(true, std::memory_order_release);
}
cond.notify_all();
@@ -28,7 +30,7 @@ void CThreadInterrupt::operator()()
bool CThreadInterrupt::sleep_for(std::chrono::milliseconds rel_time)
{
- std::unique_lock<std::mutex> lock(mut);
+ WAIT_LOCK(mut, lock);
return !cond.wait_for(lock, rel_time, [this]() { return flag.load(std::memory_order_acquire); });
}