Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
handle (badly) the timeout exception in wait_for()
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 25 Feb 2020 10:51:37 +0000 (11:51 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 25 Feb 2020 10:53:13 +0000 (11:53 +0100)
include/simgrid/exec.h
src/s4u/s4u_Exec.cpp

index 74d8ac8..95d5ff2 100644 (file)
@@ -21,4 +21,4 @@ XBT_PUBLIC void sg_exec_wait_for(sg_exec_t exec, double timeout);
 
 SG_END_DECL
 
-#endif /* INCLUDE_SIMGRID_COMM_H_ */
+#endif /* INCLUDE_SIMGRID_EXEC_H_ */
index b16393c..7048f1b 100644 (file)
@@ -3,6 +3,7 @@
 /* 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. */
 
+#include "simgrid/Exception.hpp"
 #include "simgrid/exec.h"
 #include "simgrid/s4u/Actor.hpp"
 #include "simgrid/s4u/Exec.hpp"
@@ -234,6 +235,11 @@ void sg_exec_wait(sg_exec_t exec)
 
 void sg_exec_wait_for(sg_exec_t exec, double timeout)
 {
-  exec->wait_for(timeout);
+  try {
+    exec->wait_for(timeout);
+  } catch (const simgrid::TimeoutException&) {
+    // FIXME: add better exception handling
+    XBT_DEBUG("Exec reached its timeout");
+  }
   exec->unref();
 }