From: Takishipp Date: Mon, 4 Sep 2017 15:09:44 +0000 (+0200) Subject: Almost converted phase 2 X-Git-Tag: v3_17~152^2~7 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/b2943aabdf9582425c422bc7cba044e64fdb31d9 Almost converted phase 2 --- diff --git a/examples/s4u/async-waitany/s4u_async-waitany.cpp b/examples/s4u/async-waitany/s4u_async-waitany.cpp index 97cf8b320a..c41916a87b 100644 --- a/examples/s4u/async-waitany/s4u_async-waitany.cpp +++ b/examples/s4u/async-waitany/s4u_async-waitany.cpp @@ -41,9 +41,12 @@ public: /* Here we are waiting for the completion of all communications */ while (!comms.empty()) { + comm=comms.back(); comms.pop_back(); + comm->wait(); } comms.clear(); + comm = nullptr; /* Here we are waiting for the completion of all tasks */ for (int i = 0; i < receivers_count; i++) { @@ -53,6 +56,9 @@ public: comm = nullptr; } +} +void operator()() +{ XBT_INFO("Goodbye now!"); } }; @@ -82,25 +88,27 @@ public: // returns the rank of the comm that just ended. Remove it. comm=comms.back(); comms.pop_back(); - // simgrid::s4u::this_actor::execute(comm); + comm->wait(); } comms.clear(); comm = nullptr; - +} +void operator()() +{ /* Here we tell to sender that all tasks are done */ simgrid::s4u::Mailbox::byName("finalize")->put(nullptr, 1); XBT_INFO("I'm done. See you!"); } +}; int main(int argc, char *argv[]) { simgrid::s4u::Engine *e = new simgrid::s4u::Engine(&argc,argv); + e->registerFunction("sender"); + e->registerFunction("receiver"); + e->loadDeployment(argv[2]); - - e->registerFunction("sender"); - // e->registerFunction("receiver"); - e->run(); delete e;