Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines for 2022.
[simgrid.git] / examples / cpp / exec-failure / s4u-exec-failure.cpp
index f2f9b7e..e367b03 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2021. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2021-2022. 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. */
@@ -33,11 +33,10 @@ static void dispatcher(sg4::Host* host1, sg4::Host* host2)
   exec2->start();
 
   XBT_INFO("Calling wait_any..");
-  long index;
   try {
-    index = sg4::Exec::wait_any(pending_execs);
+    long index = sg4::Exec::wait_any(pending_execs);
     XBT_INFO("Wait any returned index %ld (exec on %s)", index, pending_execs.at(index)->get_host()->get_cname());
-  } catch (simgrid::HostFailureException& e) {
+  } catch (const simgrid::HostFailureException&) {
     XBT_INFO("Dispatcher has experienced a host failure exception, so it knows that something went wrong");
     XBT_INFO("Now it needs to figure out which of the two execs failed by looking at their state");
   }
@@ -47,12 +46,12 @@ static void dispatcher(sg4::Host* host1, sg4::Host* host2)
 
   try {
     pending_execs[1]->wait();
-  } catch (simgrid::HostFailureException& e) {
+  } catch (const simgrid::HostFailureException& e) {
     XBT_INFO("Waiting on a FAILED exec raises an exception: '%s'", e.what());
   }
   pending_execs.pop_back();
   XBT_INFO("Wait for remaining exec, just to be nice");
-  index = simgrid::s4u::Exec::wait_any(pending_execs);
+  simgrid::s4u::Exec::wait_any(pending_execs);
   XBT_INFO("Dispatcher ends");
 }
 
@@ -67,7 +66,6 @@ static void host_killer(sg4::Host* to_kill)
 
 int main(int argc, char** argv)
 {
-
   sg4::Engine engine(&argc, argv);
 
   auto* zone  = sg4::create_full_zone("AS0");