Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
convert and simplify network-ns3 example
[simgrid.git] / examples / s4u / async-ready / s4u-async-ready.cpp
index 17367532a16691bab03e96b293789da5c48a4f3b..6745ee3b0bddbd68c2537d13e13c0fa164cc0d11 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2019. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2010-2020. 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. */
@@ -23,9 +23,9 @@
 #include <iostream>
 #include <string>
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_async_ready, "Messages specific for this s4u example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_async_ready, "Messages specific for this s4u example");
 
-static int peer(int argc, char** argv)
+static void peer(int argc, char** argv)
 {
   xbt_assert(argc == 5, "Expecting 4 parameters from the XML deployment file but got %d", argc);
   int my_id           = std::stoi(argv[1]); /* - my id */
@@ -72,7 +72,7 @@ static int peer(int argc, char** argv)
   while (pending_finalize_messages > 0) {
     if (my_mbox->ready()) {
       double start          = simgrid::s4u::Engine::get_clock();
-      std::string* received = static_cast<std::string*>(my_mbox->get());
+      const std::string* received = static_cast<std::string*>(my_mbox->get());
       double waiting_time   = simgrid::s4u::Engine::get_clock() - start;
       xbt_assert(waiting_time == 0, "Expecting the waiting time to be 0 because the communication was supposedly ready, but got %f instead", waiting_time);
       XBT_INFO("I got a '%s'.", received->c_str());
@@ -90,7 +90,6 @@ static int peer(int argc, char** argv)
   simgrid::s4u::Comm::wait_all(&pending_comms);
 
   XBT_INFO("Goodbye now!");
-  return 0;
 }