From: Razvan Becheriu Date: Sat, 7 Mar 2020 14:45:03 +0000 (+0200) Subject: [#1016] addressed review X-Git-Tag: Kea-1.7.6~73 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bd53cf07bf9cef2c425322cfaf5e65ae8c319c21;p=thirdparty%2Fkea.git [#1016] addressed review --- diff --git a/src/lib/util/multi_threading_mgr.cc b/src/lib/util/multi_threading_mgr.cc index 3606e5cf2f..5ebfb110e6 100644 --- a/src/lib/util/multi_threading_mgr.cc +++ b/src/lib/util/multi_threading_mgr.cc @@ -34,6 +34,7 @@ MultiThreadingMgr::setMode(bool enabled) { void MultiThreadingMgr::enterCriticalSection() { + stopPktProcessing(); ++critical_section_count_; } @@ -43,6 +44,7 @@ MultiThreadingMgr::exitCriticalSection() { isc_throw(InvalidOperation, "invalid negative value for override"); } --critical_section_count_; + startPktProcessing(); } bool @@ -115,13 +117,11 @@ MultiThreadingMgr::startPktProcessing() { } MultiThreadingCriticalSection::MultiThreadingCriticalSection() { - MultiThreadingMgr::instance().stopPktProcessing(); MultiThreadingMgr::instance().enterCriticalSection(); } MultiThreadingCriticalSection::~MultiThreadingCriticalSection() { MultiThreadingMgr::instance().exitCriticalSection(); - MultiThreadingMgr::instance().startPktProcessing(); } } // namespace util diff --git a/src/lib/util/multi_threading_mgr.h b/src/lib/util/multi_threading_mgr.h index 62bfb22502..baced1ab61 100644 --- a/src/lib/util/multi_threading_mgr.h +++ b/src/lib/util/multi_threading_mgr.h @@ -115,16 +115,6 @@ public: /// configured, 0 if auto scaling is desired void apply(bool enabled, uint32_t thread_count); - /// @brief Class method stopping and joining all threads of the pool. - /// - /// Stop the packet thread pool if running. - void stopPktProcessing(); - - /// @brief Class method (re)starting threads of the pool. - /// - /// Start the packet thread pool according to current configuration. - void startPktProcessing(); - protected: /// @brief Constructor. @@ -135,6 +125,16 @@ protected: private: + /// @brief Class method stopping and joining all threads of the pool. + /// + /// Stop the packet thread pool if running. + void stopPktProcessing(); + + /// @brief Class method (re)starting threads of the pool. + /// + /// Start the packet thread pool according to current configuration. + void startPktProcessing(); + /// @brief The current multi-threading mode. /// /// The multi-threading flag: true if multi-threading is enabled, false