]> AND Public Git Repository - simgrid.git/blobdiff - teshsuite/s4u/dependencies/dependencies.cpp
Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix cover-evaluate-get-route-time test
[simgrid.git] / teshsuite / s4u / dependencies / dependencies.cpp
index 697c512d943bdd87b56b39c12a24f7c28e22e524..f0f2ba658fae8778ced3cbb9fbe89ba48f650e6a 100644 (file)
@@ -13,9 +13,12 @@ int main(int argc, char** argv)
   xbt_assert(argc > 1, "Usage: %s platform_file\n\nExample: %s two_clusters.xml", argv[0], argv[0]);
   e.load_platform(argv[1]);
 
-  simgrid::s4u::Exec::on_completion.connect([](simgrid::s4u::Exec const& exec) {
-    XBT_INFO("Exec '%s' start time: %f, finish time: %f", exec.get_cname(), exec.get_start_time(),
-             exec.get_finish_time());
+  simgrid::s4u::Activity::on_completion_cb([](simgrid::s4u::Activity& activity) {
+    const auto* exec = dynamic_cast<simgrid::s4u::Exec*>(&activity);
+    if (exec == nullptr) // Only Execs are concerned here
+      return;
+    XBT_INFO("Exec '%s' start time: %f, finish time: %f", exec->get_cname(), exec->get_start_time(),
+             exec->get_finish_time());
   });
 
   /* creation of the activities and their dependencies */
@@ -32,7 +35,7 @@ int main(int argc, char** argv)
 
   try {
     A->add_successor(A);
-    /* shouldn't work and must raise an exception */
+    /* shouldn't work and must raise an exception */
     xbt_die("Hey, I can add a dependency between A and A!");
   } catch (const std::invalid_argument& e) {
     XBT_INFO("Caught attempt to self-dependency creation: %s", e.what());