X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/84402e8e2ee2a2d0bef25fdceb0a263ed8b471f6..4b7251c4ac80f95f82ac25ecfb3a9f618150cb11:/examples/s4u/async-waituntil/s4u-async-waituntil.cpp diff --git a/examples/s4u/async-waituntil/s4u-async-waituntil.cpp b/examples/s4u/async-waituntil/s4u-async-waituntil.cpp index 3b2975bafe..d63273f8ae 100644 --- a/examples/s4u/async-waituntil/s4u-async-waituntil.cpp +++ b/examples/s4u/async-waituntil/s4u-async-waituntil.cpp @@ -17,22 +17,22 @@ 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 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[])