]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2799] disable MT on destructor (UT do not use run)
authorRazvan Becheriu <razvan@isc.org>
Fri, 24 Mar 2023 09:25:57 +0000 (11:25 +0200)
committerRazvan Becheriu <razvan@isc.org>
Fri, 24 Mar 2023 10:12:40 +0000 (12:12 +0200)
src/bin/dhcp4/ctrl_dhcp4_srv.cc
src/bin/dhcp4/tests/kea_controller_unittest.cc
src/bin/dhcp6/ctrl_dhcp6_srv.cc
src/bin/dhcp6/tests/kea_controller_unittest.cc

index 436f2d982a7250e9f1c41779b965695e4fd34179..db54107759a4cca6776949fe496286693feb278b 100644 (file)
@@ -1208,6 +1208,7 @@ void ControlledDhcpv4Srv::shutdownServer(int exit_value) {
 
 ControlledDhcpv4Srv::~ControlledDhcpv4Srv() {
     try {
+        MultiThreadingMgr::instance().apply(false, 0, 0);
         LeaseMgrFactory::destroy();
         HostMgr::create();
         cleanup();
index 7578833c0dddfef228a6ee261b31e127caf7b701..d164a23678505528e23b22166c4e363de1fe26c1 100644 (file)
@@ -230,10 +230,10 @@ public:
     void runTimersWithTimeout(const IOServicePtr& io_service, const long timeout_ms,
                               std::function<bool()> cond = std::function<bool()>()) {
         IntervalTimer timer(*io_service);
-        bool stopped = false;
+        std::atomic<bool> stopped = false;
         timer.setup([&io_service, &stopped]() {
-            io_service->stop();
             stopped = true;
+            io_service->stop();
         }, timeout_ms, IntervalTimer::ONE_SHOT);
 
         // Run as long as the timeout hasn't occurred and the interrupting
index b4d9e0d2ed2c7bf15ac860ea510469673398b428..710bd18ad2cde8991dc701897f667530ca3fb01c 100644 (file)
@@ -1228,6 +1228,7 @@ void ControlledDhcpv6Srv::shutdownServer(int exit_value) {
 
 ControlledDhcpv6Srv::~ControlledDhcpv6Srv() {
     try {
+        MultiThreadingMgr::instance().apply(false, 0, 0);
         LeaseMgrFactory::destroy();
         HostMgr::create();
         cleanup();
index a1249132726ee83278c20436e9f950fd7f570f07..d932d4223629ff3755e6f1aa4201eb0a155bba54 100644 (file)
@@ -217,10 +217,10 @@ public:
     void runTimersWithTimeout(const IOServicePtr& io_service, const long timeout_ms,
                               std::function<bool()> cond = std::function<bool()>()) {
         IntervalTimer timer(*io_service);
-        bool stopped = false;
+        std::atomic<bool> stopped = false;
         timer.setup([&io_service, &stopped]() {
-            io_service->stop();
             stopped = true;
+            io_service->stop();
         }, timeout_ms, IntervalTimer::ONE_SHOT);
 
         // Run as long as the timeout hasn't occurred and the interrupting