-/* Copyright (c) 2007-2021. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2007-2022. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
auto fafard = e.host_by_name("Fafard");
// Display the details on vetoed activities
- simgrid::s4u::Activity::on_veto.connect([](simgrid::s4u::Activity& a) {
- auto& exec = static_cast<simgrid::s4u::Exec&>(a); // all activities are execs in this example
+ simgrid::s4u::Activity::on_veto_cb([](const simgrid::s4u::Activity& a) {
+ const auto& exec = static_cast<const simgrid::s4u::Exec&>(a); // all activities are execs in this example
XBT_INFO("Activity '%s' vetoed. Dependencies: %s; Ressources: %s", exec.get_cname(),
(exec.dependencies_solved() ? "solved" : "NOT solved"),
(exec.is_assigned() ? "assigned" : "NOT assigned"));
});
- simgrid::s4u::Exec::on_completion.connect([](simgrid::s4u::Exec const& exec) {
- XBT_INFO("Activity '%s' is complete (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("Activity '%s' is complete (start time: %f, finish time: %f)", exec->get_cname(), exec->get_start_time(),
+ exec->get_finish_time());
});
// Define an amount of work that should take 1 second to execute.