X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/fe620eda269ea46829c7c46afefa3650c6a509cd..122a5a2813fd6d64d4db8ee7f1fdb5a62b7e0d6a:/teshsuite/s4u/issue71/issue71.cpp diff --git a/teshsuite/s4u/issue71/issue71.cpp b/teshsuite/s4u/issue71/issue71.cpp index cc1a018014..7b5ed74ea3 100644 --- a/teshsuite/s4u/issue71/issue71.cpp +++ b/teshsuite/s4u/issue71/issue71.cpp @@ -1,26 +1,29 @@ +/* Copyright (c) 2021-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. */ + #include #include - -using namespace std; -using namespace simgrid; +#include static void runner() { - auto e = s4u::Engine::get_instance(); + auto* e = simgrid::s4u::Engine::get_instance(); simgrid::s4u::Host* host0 = e->host_by_name("c1_0"); simgrid::s4u::Host* host1 = e->host_by_name("c2_0"); std::vector comp = {1e6, 1e6}; std::vector comm = {1, 2, 3, 4}; - vector h1 = {host0, host1}; + std::vector h1 = {host0, host1}; simgrid::s4u::this_actor::parallel_execute(h1, comp, comm); } int main(int argc, char* argv[]) { - s4u::Engine e(&argc, argv); - e.set_config("host/model:ptask_L07"); + simgrid::s4u::Engine e(&argc, argv); + simgrid::s4u::Engine::set_config("host/model:ptask_L07"); xbt_assert(argc == 2, "\nUsage: %s platform_ok.xml\n" @@ -28,10 +31,14 @@ int main(int argc, char* argv[]) argv[0], argv[0]); const char* platform_file = argv[1]; - e.load_platform(platform_file); - simgrid::s4u::Actor::create("actor", e.host_by_name("c1_0"), runner); + try { + e.load_platform(platform_file); + simgrid::s4u::Actor::create("actor", e.host_by_name("c1_0"), runner); + e.run(); + } catch (const simgrid::AssertionError& e) { + std::cout << e.what() << "\n"; + } - e.run(); return 0; }