Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines for 2023.
[simgrid.git] / examples / smpi / smpi_s4u_masterworker / masterworker_mailbox_smpi.cpp
index c81e697..43587a9 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2020. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2010-2023. 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. */
@@ -9,7 +9,7 @@
 #include <array>
 #include <cstdio> /* snprintf */
 
-XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example");
+XBT_LOG_NEW_DEFAULT_CATEGORY(smpi_masterworkers, "Messages specific for this example");
 
 static void master(std::vector<std::string> args)
 {
@@ -51,9 +51,8 @@ static void worker(std::vector<std::string> args)
 
   double compute_cost;
   do {
-    const auto* msg   = static_cast<double*>(mailbox->get());
-    compute_cost      = *msg;
-    delete msg;
+    auto msg     = mailbox->get_unique<double>();
+    compute_cost = *msg;
 
     if (compute_cost > 0) /* If compute_cost is valid, execute a computation of that cost */
       simgrid::s4u::this_actor::execute(compute_cost);
@@ -106,7 +105,7 @@ int main(int argc, char* argv[])
 
   xbt_assert(argc > 2,
              "Usage: %s platform_file deployment_file\n"
-             "\nexample: %s msg_platform.xml msg_deployment.xml\n",
+             "\nexample: %s platform.xml deployment.xml\n",
              argv[0], argv[0]);
 
   e.load_platform(argv[1]);
@@ -121,7 +120,7 @@ int main(int argc, char* argv[])
 
   e.run();
 
-  XBT_INFO("Simulation time %g", e.get_clock());
+  XBT_INFO("Simulation time %g", simgrid::s4u::Engine::get_clock());
 
   SMPI_finalize();
   return 0;