From 20c6d7057b72c3faa9fdca0cfab4b38262f85eae Mon Sep 17 00:00:00 2001
From: philippegorley <philippe.gorley@savoirfairelinux.com>
Date: Fri, 29 Jun 2018 14:26:19 -0400
Subject: [PATCH] thread: add way to notify waiting thread of changes

Don't notify on stop.

Change-Id: Ic3eead63c4756d1790da1ba7223a431cbc238232
---
 src/threadloop.cpp | 1 -
 src/threadloop.h   | 5 +++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/threadloop.cpp b/src/threadloop.cpp
index 4cc4fd4042..1f95bb67c9 100644
--- a/src/threadloop.cpp
+++ b/src/threadloop.cpp
@@ -142,7 +142,6 @@ void
 InterruptedThreadLoop::stop()
 {
     ThreadLoop::stop();
-    std::lock_guard<std::mutex> lk(mutex_);
     cv_.notify_one();
 }
 } // namespace ring
diff --git a/src/threadloop.h b/src/threadloop.h
index a5eb3d6500..33d6bf8ea6 100644
--- a/src/threadloop.h
+++ b/src/threadloop.h
@@ -86,6 +86,11 @@ public:
 
     void stop() override;
 
+    void interrupt() noexcept
+    {
+        cv_.notify_one();
+    }
+
     template <typename Rep, typename Period>
     void
     wait_for(const std::chrono::duration<Rep, Period>& rel_time)
-- 
GitLab