From: Frederic Suter Date: Tue, 25 Feb 2020 10:51:37 +0000 (+0100) Subject: handle (badly) the timeout exception in wait_for() X-Git-Tag: v3.26~881 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/09672882edafb2d47c31b4c3e45543cc5ede5827?ds=sidebyside;hp=9caefc9fd82f338d9f8b9eede38a171aaff5f4bc handle (badly) the timeout exception in wait_for() --- diff --git a/include/simgrid/exec.h b/include/simgrid/exec.h index 74d8ac8ff9..95d5ff24f9 100644 --- a/include/simgrid/exec.h +++ b/include/simgrid/exec.h @@ -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_ */ diff --git a/src/s4u/s4u_Exec.cpp b/src/s4u/s4u_Exec.cpp index b16393c97f..7048f1bea5 100644 --- a/src/s4u/s4u_Exec.cpp +++ b/src/s4u/s4u_Exec.cpp @@ -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(); }