]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#883, !506] must use mutex when changing state of predicate component
authorRazvan Becheriu <razvan@isc.org>
Thu, 21 Nov 2019 13:25:57 +0000 (15:25 +0200)
committerRazvan Becheriu <razvan@isc.org>
Fri, 22 Nov 2019 07:19:23 +0000 (09:19 +0200)
src/lib/util/thread_pool.h

index 946958dcbddbd687f36631eeeb00686e51d81be5..87727f0efdfceb93fc489c9479b206e6b7b872ad 100644 (file)
@@ -207,6 +207,7 @@ private:
         ///
         /// Sets the queue state to 'enabled'
         void enable() {
+            std::lock_guard<std::mutex> lock(mutex_);
             enabled_ = true;
         }
 
@@ -214,7 +215,10 @@ private:
         ///
         /// Sets the queue state to 'disabled'
         void disable() {
-            enabled_ = false;
+            {
+                std::lock_guard<std::mutex> lock(mutex_);
+                enabled_ = false;
+            }
             // Notify pop so that it can exit.
             cv_.notify_all();
         }