Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
You don't send a mailbox, but instead put stuff on it
[simgrid.git] / examples / s4u / app-token-ring / s4u_app-token-ring.cpp
index 266b60c..a5fc167 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2017. 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. */
@@ -36,15 +36,15 @@ public:
     if (rank == 0) {
       /* The root process (rank 0) first sends the token then waits to receive it back */
       XBT_INFO("Host \"%u\" send 'Token' to Host \"%s\"", rank, neighbor_mailbox->name());
-      simgrid::s4u::this_actor::send(neighbor_mailbox, xbt_strdup("Token"), task_comm_size);
-      char* res = static_cast<char*>(simgrid::s4u::this_actor::recv(my_mailbox));
+      neighbor_mailbox->put(xbt_strdup("Token"), task_comm_size);
+      char* res = static_cast<char*>(my_mailbox->get());
       XBT_INFO("Host \"%u\" received \"%s\"", rank, res);
       xbt_free(res);
     } else {
-      char* res = static_cast<char*>(simgrid::s4u::this_actor::recv(my_mailbox));
+      char* res = static_cast<char*>(my_mailbox->get());
       XBT_INFO("Host \"%u\" received \"%s\"", rank, res);
       XBT_INFO("Host \"%u\" send 'Token' to Host \"%s\"", rank, neighbor_mailbox->name());
-      simgrid::s4u::this_actor::send(neighbor_mailbox, res, task_comm_size);
+      neighbor_mailbox->put(res, task_comm_size);
     }
   }
 };
@@ -66,5 +66,7 @@ int main(int argc, char** argv)
   }
   e->run();
   XBT_INFO("Simulation time %g", e->getClock());
+
+  delete e;
   return 0;
 }