X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/e4c3e60acadc7b5ca6238866641567bae9539067..d17f206ea75d3cccc5f1b83b67f58d4fe87781d1:/src/simix/SynchroComm.cpp diff --git a/src/simix/SynchroComm.cpp b/src/simix/SynchroComm.cpp index b074baa3aa..4342cb107e 100644 --- a/src/simix/SynchroComm.cpp +++ b/src/simix/SynchroComm.cpp @@ -109,3 +109,30 @@ void simgrid::simix::Comm::cleanupSurf() dst_timeout = NULL; } } + +void simgrid::simix::Comm::post() +{ + /* Update synchro state */ + if (src_timeout && src_timeout->getState() == simgrid::surf::Action::State::done) + state = SIMIX_SRC_TIMEOUT; + else if (dst_timeout && dst_timeout->getState() == simgrid::surf::Action::State::done) + state = SIMIX_DST_TIMEOUT; + else if (src_timeout && src_timeout->getState() == simgrid::surf::Action::State::failed) + state = SIMIX_SRC_HOST_FAILURE; + else if (dst_timeout && dst_timeout->getState() == simgrid::surf::Action::State::failed) + state = SIMIX_DST_HOST_FAILURE; + else if (surf_comm && surf_comm->getState() == simgrid::surf::Action::State::failed) { + state = SIMIX_LINK_FAILURE; + } else + state = SIMIX_DONE; + + XBT_DEBUG("SIMIX_post_comm: comm %p, state %d, src_proc %p, dst_proc %p, detached: %d", + this, (int)state, src_proc, dst_proc, detached); + + /* destroy the surf actions associated with the Simix communication */ + cleanupSurf(); + + /* if there are simcalls associated with the synchro, then answer them */ + if (xbt_fifo_size(simcalls)) + SIMIX_comm_finish(this); +}