X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f748ce48955ffc37989647090ef5b5a6676b7cd1..b08cf565e62c980d3fa23c031b341ca4f1427bd9:/src/simix/SynchroExec.cpp diff --git a/src/simix/SynchroExec.cpp b/src/simix/SynchroExec.cpp index 02ce12513a..3b0f2c84b2 100644 --- a/src/simix/SynchroExec.cpp +++ b/src/simix/SynchroExec.cpp @@ -5,7 +5,13 @@ #include "src/simix/SynchroExec.hpp" #include "src/surf/surf_interface.hpp" +#include "src/simix/smx_host_private.h" +simgrid::simix::Exec::~Exec() +{ + if (surf_exec) + surf_exec->unref(); +} void simgrid::simix::Exec::suspend() { if (surf_exec) @@ -26,14 +32,25 @@ double simgrid::simix::Exec::remains() return 0; } -void simgrid::simix::Exec::unref() +void simgrid::simix::Exec::post() { - refcount--; - if (refcount > 0) - return; - - if (surf_exec) + if (host && host->isOff()) {/* FIMXE: handle resource failure for parallel tasks too */ + /* If the host running the synchro failed, notice it. This way, the asking + * process can be killed if it runs on that host itself */ + state = SIMIX_FAILED; + } else if (surf_exec->getState() == simgrid::surf::Action::State::failed) { + /* If the host running the synchro didn't fail, then the synchro was canceled */ + state = SIMIX_CANCELED; + } else { + state = SIMIX_DONE; + } + + if (surf_exec) { surf_exec->unref(); + surf_exec = NULL; + } - delete this; + /* If there are simcalls associated with the synchro, then answer them */ + if (xbt_fifo_size(simcalls)) + SIMIX_execution_finish(this); }