Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Almost converted phase 2
authorTakishipp <toufik.boubehziz@gmail.com>
Mon, 4 Sep 2017 15:09:44 +0000 (17:09 +0200)
committerTakishipp <toufik.boubehziz@gmail.com>
Mon, 4 Sep 2017 15:09:44 +0000 (17:09 +0200)
examples/s4u/async-waitany/s4u_async-waitany.cpp

index 97cf8b3..c41916a 100644 (file)
@@ -41,9 +41,12 @@ public:
 
   /* Here we are waiting for the completion of all communications */
   while (!comms.empty()) {
 
   /* Here we are waiting for the completion of all communications */
   while (!comms.empty()) {
+    comm=comms.back();
     comms.pop_back();
     comms.pop_back();
+    comm->wait();
   }
   comms.clear();
   }
   comms.clear();
+  comm = nullptr;
 
   /* Here we are waiting for the completion of all tasks */
   for (int i = 0; i < receivers_count; i++) {
 
   /* 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;
   }
 
     comm = nullptr;
   }
 
+}
+void operator()()
+{
   XBT_INFO("Goodbye now!");
 }
 };
   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();
     // 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;
   }
   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!");
 }
   /* 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);  
 
 
 int main(int argc, char *argv[])
 {
   simgrid::s4u::Engine *e = new simgrid::s4u::Engine(&argc,argv);  
 
+   e->registerFunction<sender>("sender");   
+   e->registerFunction<receiver>("receiver");  
+  
   e->loadDeployment(argv[2]); 
   e->loadDeployment(argv[2]); 
-  e->registerFunction<sender>("sender");   
-  // e->registerFunction<receiver>("receiver");  
-
   e->run();
 
   delete e;
   e->run();
 
   delete e;