]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[970-implement-multi-threading-critical-section] Removed the enabled_ local copy... 970-implement-multi-threading-critical-section
authorFrancis Dupont <fdupont@isc.org>
Tue, 5 Nov 2019 14:51:38 +0000 (15:51 +0100)
committerFrancis Dupont <fdupont@isc.org>
Tue, 5 Nov 2019 14:51:38 +0000 (15:51 +0100)
src/lib/dhcpsrv/multi_threading_utils.cc
src/lib/dhcpsrv/multi_threading_utils.h

index 99d182dad796f64dfdca373f58fd131357ae246c..e12c89c22991c60394c9ceb294fd16b50f1a9644 100644 (file)
@@ -29,15 +29,14 @@ MultiThreadingCriticalSection::startPktProcessing() {
               "is not yet implemented");
 }
 
-MultiThreadingCriticalSection::MultiThreadingCriticalSection()
-    : enabled_(MultiThreadingMgr::instance().getMode()) {
-    if (enabled_) {
+MultiThreadingCriticalSection::MultiThreadingCriticalSection() {
+    if (MultiThreadingMgr::instance().getMode()) {
         stopPktProcessing();
     }
 }
 
 MultiThreadingCriticalSection::~MultiThreadingCriticalSection() {
-    if (enabled_) {
+    if (MultiThreadingMgr::instance().getMode()) {
         startPktProcessing();
     }
 }
index 87c6b55f2feeab455bc10106c03baeee10405107..ef5615736f3dc4733080c22ae6ad50ad71ee3382 100644 (file)
@@ -12,7 +12,7 @@
 namespace isc {
 namespace dhcp {
 
-/// @note: everything here MUST be used only from the main thread.
+/// @note: everything here MUST be used ONLY from the main thread.
 /// When called from a thread of the pool it can deadlock.
 
 /// @brief Function stopping and joining all threads of the pool.
@@ -24,6 +24,9 @@ void stopPktProcessing();
 void startPktProcessing();
 
 /// @brief RAII class creating a critical section.
+///
+/// @note: the multi-threading mode MUST NOT be changed in the RAII
+/// @c MultiThreadingCriticalSection body.
 class MultiThreadingCriticalSection : public boost::noncopyable {
 public:
     /// @brief Constructor.
@@ -41,10 +44,6 @@ public:
     /// @brief Class method (re)starting threads of the pool.
     /// @throw isc::NotImplemented until is implemented.
     static void startPktProcessing();
-
-private:
-    /// @brief Local copy of the multi-threading mode.
-    bool enabled_;
 };
 
 }