]> AND Public Git Repository - simgrid.git/blobdiff - docs/source/tuto_s4u/master-workers-lab4.cpp
Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] Replace long list of cases in switch by a set.
[simgrid.git] / docs / source / tuto_s4u / master-workers-lab4.cpp
index 819fd4ea490d5d37384cd7ed41b9756eb0dc7270..c2c8f4d3b2550400fa5837745d567e948f2f6a9f 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2019. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2010-2020. 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. */
@@ -22,9 +22,8 @@ static void worker(std::string category)
   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         = static_cast<double*>(mailbox->get());
+    auto msg            = mailbox->get_unique<double>();
     double compute_cost = *msg;
-    delete msg;
 
     // simgrid::s4u::this_actor::exec_init(compute_cost)->set_tracing_category(category)->wait();
     /* Long form:*/