Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use Mailbox::get_unique<>(), and save a few delete.
[simgrid.git] / docs / source / tuto_s4u / master-workers-lab3.cpp
index a2f3963a97ef9a229f40e4b941d9691f9e109c38..5e012ff5282d689837d7975220f8d48d556a9a87 100644 (file)
@@ -22,9 +22,8 @@ static void worker()
   simgrid::s4u::Mailbox* mailbox   = simgrid::s4u::Mailbox::by_name(mailbox_name);
 
   while (true) { // Master forcefully kills the workers by the end of the simulation
-    double* msg         = mailbox->get<double>();
+    auto msg            = mailbox->get_unique<double>();
     double compute_cost = *msg;
-    delete msg;
 
     simgrid::s4u::this_actor::execute(compute_cost);
   }