Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
move the rootAS from routing_platf into the EngineImpl
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 5 Dec 2016 08:18:05 +0000 (09:18 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 5 Dec 2016 18:34:08 +0000 (19:34 +0100)
Now that we instanciate a s4u::Engine when using the routing, the
surf_usage tests don't have to manually call surf_exit(): it called
atexit() during initialization. Gosh, it took me so long to figure out
why these two tests would break when the rootAs is moved...

src/s4u/s4u_engine.cpp
src/surf/sg_platf.cpp
src/surf/surf_routing.cpp
src/surf/surf_routing.hpp
teshsuite/surf/surf_usage/surf_usage.cpp
teshsuite/surf/surf_usage2/surf_usage2.cpp

index 1516008..96f3fff 100644 (file)
@@ -88,8 +88,7 @@ void Engine::run() {
 
 s4u::As *Engine::rootAs()
 {
-  return routing_platf->root_; // FIXME: get the root into the Engine directly (and kill the platf)
-  // return pimpl->rootAs_;
+  return pimpl->rootAs_;
 }
 
 static s4u::As *asByNameRecursive(s4u::As *current, const char *name)
index 6d42adc..4498af4 100644 (file)
@@ -14,6 +14,8 @@
 #include "src/surf/HostImpl.hpp"
 #include "surf/surf.h"
 
+#include "simgrid/s4u/engine.hpp"
+#include "src/kernel/EngineImpl.hpp"
 #include "src/simix/smx_private.h"
 
 #include "src/include/simgrid/sg_config.h"
@@ -22,7 +24,6 @@
 #include "src/surf/HostImpl.hpp"
 #include "src/surf/cpu_interface.hpp"
 #include "src/surf/network_interface.hpp"
-#include "surf/surf_routing.h" // FIXME: brain dead public header
 
 #include "src/kernel/routing/AsImpl.hpp"
 #include "src/kernel/routing/AsCluster.hpp"
@@ -768,8 +769,9 @@ simgrid::s4u::As * sg_platf_new_AS_begin(sg_platf_AS_cbarg_t AS)
   }
 
   if (current_routing == nullptr) { /* it is the first one */
-    xbt_assert(routing_platf->root_ == nullptr, "All defined components must belong to a AS");
-    routing_platf->root_ = new_as;
+    xbt_assert(simgrid::s4u::Engine::instance()->pimpl->rootAs_ == nullptr,
+               "All defined components must belong to a AS");
+    simgrid::s4u::Engine::instance()->pimpl->rootAs_ = new_as;
 
   } else {
     /* set the father behavior */
index a360296..777f4d7 100644 (file)
@@ -107,7 +107,4 @@ void routing_exit() {
 }
 
 simgrid::kernel::routing::RoutingPlatf::RoutingPlatf() = default;
-simgrid::kernel::routing::RoutingPlatf::~RoutingPlatf()
-{
-  delete root_;
-}
+simgrid::kernel::routing::RoutingPlatf::~RoutingPlatf() = default;
index 798e4c8..0d99e6a 100644 (file)
@@ -107,7 +107,6 @@ XBT_PUBLIC_CLASS RoutingPlatf {
 public:
   explicit RoutingPlatf();
   ~RoutingPlatf();
-  AsImpl *root_ = nullptr;
 };
 
 }}}
index 11f4c7e..8f60d2b 100644 (file)
@@ -119,6 +119,5 @@ int main(int argc, char **argv)
 
   XBT_DEBUG("Simulation Terminated");
 
-  surf_exit();
   return 0;
 }
index 1b9d258..27a1ac9 100644 (file)
@@ -72,6 +72,5 @@ int main(int argc, char **argv)
   } while (running && surf_solve(-1.0) >= 0.0);
 
   XBT_INFO("Simulation Terminated");
-  surf_exit();
   return 0;
 }