X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/67d66b0cf79b9fc02c0450f254584693dbf21d3b..8bf7ffc43ad5507982e924a7f05bbb13c89965cb:/examples/cpp/platform-failures/s4u-platform-failures.cpp diff --git a/examples/cpp/platform-failures/s4u-platform-failures.cpp b/examples/cpp/platform-failures/s4u-platform-failures.cpp index 0417ef6aaf..f622d905ad 100644 --- a/examples/cpp/platform-failures/s4u-platform-failures.cpp +++ b/examples/cpp/platform-failures/s4u-platform-failures.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2021. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2007-2023. 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. */ @@ -38,7 +38,7 @@ static void master(std::vector args) XBT_INFO("Got %ld workers and %ld tasks to process", workers_count, number_of_tasks); for (int i = 0; i < number_of_tasks; i++) { - mailbox = sg4::Mailbox::by_name(std::string("worker-") + std::to_string(i % workers_count)); + mailbox = sg4::Mailbox::by_name("worker-" + std::to_string(i % workers_count)); auto* payload = new double(comp_size); try { XBT_INFO("Send a message to %s", mailbox->get_cname()); @@ -56,7 +56,7 @@ static void master(std::vector args) XBT_INFO("All tasks have been dispatched. Let's tell everybody the computation is over."); for (int i = 0; i < workers_count; i++) { /* - Eventually tell all the workers to stop by sending a "finalize" task */ - mailbox = sg4::Mailbox::by_name(std::string("worker-") + std::to_string(i)); + mailbox = sg4::Mailbox::by_name("worker-" + std::to_string(i)); auto* payload = new double(-1.0); try { mailbox->put(payload, 0, 1.0); @@ -76,7 +76,7 @@ static void worker(std::vector args) { xbt_assert(args.size() == 2, "Expecting one parameter"); long id = std::stol(args[1]); - sg4::Mailbox* mailbox = sg4::Mailbox::by_name(std::string("worker-") + std::to_string(id)); + sg4::Mailbox* mailbox = sg4::Mailbox::by_name("worker-" + std::to_string(id)); while (true) { try { XBT_INFO("Waiting a message on %s", mailbox->get_cname()); @@ -118,8 +118,8 @@ int main(int argc, char* argv[]) // Add a new host programatically, and attach a state profile to it auto* root = e.get_netzone_root(); auto* lilibeth = root->create_host("Lilibeth", 1e15); - auto link = sg4::LinkInRoute(e.link_by_name("10")); - root->add_route(e.host_by_name("Tremblay")->get_netpoint(), lilibeth->get_netpoint(), nullptr, nullptr, {link}, true); + auto link = e.link_by_name("10"); + root->add_route(e.host_by_name("Tremblay"), lilibeth, {link}); lilibeth->set_state_profile(simgrid::kernel::profile::ProfileBuilder::from_string("lilibeth_profile", R"( 4 0 5 1