X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a35857675df75b15725d79c3542dc56e24500e3e..40ee10e13b61bfb28374d96ade010a262b5abd44:/examples/cpp/comm-suspend/s4u-comm-suspend.cpp?ds=sidebyside diff --git a/examples/cpp/comm-suspend/s4u-comm-suspend.cpp b/examples/cpp/comm-suspend/s4u-comm-suspend.cpp index 7af40f94ef..f3ec48e920 100644 --- a/examples/cpp/comm-suspend/s4u-comm-suspend.cpp +++ b/examples/cpp/comm-suspend/s4u-comm-suspend.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2021. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2010-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. */ @@ -13,10 +13,8 @@ namespace sg4 = simgrid::s4u; XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_comm_wait, "Messages specific for this s4u example"); -static void sender(int argc, char**) +static void sender() { - xbt_assert(argc == 1, "Expecting no parameter from the XML deployment file but got %d", argc - 1); - sg4::Mailbox* mbox = sg4::Mailbox::by_name("receiver"); // Copy the data we send: the 'msg_content' variable is not a stable storage location. @@ -43,7 +41,7 @@ static void sender(int argc, char**) comm->suspend(); } -static void receiver(int, char**) +static void receiver() { sg4::Mailbox* mbox = sg4::Mailbox::by_name("receiver"); XBT_INFO("Wait for the message."); @@ -54,14 +52,13 @@ static void receiver(int, char**) int main(int argc, char* argv[]) { - xbt_assert(argc > 2, "Usage: %s platform_file deployment_file\n", argv[0]); - sg4::Engine e(&argc, argv); - e.register_function("sender", &sender); - e.register_function("receiver", &receiver); e.load_platform(argv[1]); - e.load_deployment(argv[2]); + + sg4::Actor::create("sender", e.host_by_name("Tremblay"), sender); + sg4::Actor::create("receiver", e.host_by_name("Jupiter"), receiver); + e.run(); return 0;