Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix some long -> double faulty convertions reported by sonar
[simgrid.git] / examples / s4u / async-waituntil / s4u-async-waituntil.cpp
index 3b2975bafe170b39249582d8feeea6762300c17d..d63273f8aec5bd61cfccf27813a6b8ef80b38935 100644 (file)
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(s4u_async_waituntil, "Messages specific for this s4u example");
 
-static int sender(int argc, char** argv)
+static void sender(int argc, char** argv)
 {
   xbt_assert(argc == 4, "Expecting 3 parameters from the XML deployment file but got %d", argc);
-  long messages_count  = std::stol(argv[1]); /* - number of tasks */
-  double msg_size      = std::stol(argv[2]); /* - communication cost in bytes */
-  long receivers_count = std::stod(argv[3]); /* - number of receivers */
+  long messages_count  = std::stol(argv[1]); /* - number of messages */
+  double msg_size      = std::stod(argv[2]); /* - message size in bytes */
+  long receivers_count = std::stol(argv[3]); /* - number of receivers */
 
   std::vector<simgrid::s4u::CommPtr> pending_comms;
 
   /* Start dispatching all messages to receivers, in a round robin fashion */
   for (int i = 0; i < messages_count; i++) {
-
     std::string mboxName          = std::string("receiver-") + std::to_string(i % receivers_count);
     simgrid::s4u::Mailbox* mbox   = simgrid::s4u::Mailbox::by_name(mboxName);
     std::string msgName           = std::string("Message ") + std::to_string(i);
     std::string* payload          = new std::string(msgName); // copy the data we send:
+
     // 'msgName' is not a stable storage location
     XBT_INFO("Send '%s' to '%s'", msgName.c_str(), mboxName.c_str());
     /* Create a communication representing the ongoing communication */
@@ -61,11 +61,10 @@ static int sender(int argc, char** argv)
   }
 
   XBT_INFO("Goodbye now!");
-  return 0;
 }
 
 /* Receiver actor expects 1 argument: its ID */
-static int receiver(int argc, char** argv)
+static void receiver(int argc, char** argv)
 {
   xbt_assert(argc == 2, "Expecting one parameter from the XML deployment file but got %d", argc);
   simgrid::s4u::Mailbox* mbox = simgrid::s4u::Mailbox::by_name(std::string("receiver-") + argv[1]);
@@ -78,7 +77,6 @@ static int receiver(int argc, char** argv)
       cont = false; // If it's a finalize message, we're done.
     delete received;
   }
-  return 0;
 }
 
 int main(int argc, char* argv[])