From: Martin Quinson Date: Sun, 13 May 2018 20:10:04 +0000 (+0200) Subject: cleanups in the wannabe Activity::test() X-Git-Tag: v3.20~231 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/707cecf2b83fe50617ac9ec01252fd2d96edcc88 cleanups in the wannabe Activity::test() --- diff --git a/src/simix/smx_host.cpp b/src/simix/smx_host.cpp index a2cc7678be..3e9573a26e 100644 --- a/src/simix/smx_host.cpp +++ b/src/simix/smx_host.cpp @@ -210,16 +210,14 @@ void simcall_HANDLER_execution_wait(smx_simcall_t simcall, smx_activity_t synchr void simcall_HANDLER_execution_test(smx_simcall_t simcall, smx_activity_t synchro) { - simcall_execution_test__set__result(simcall, (synchro->state_ != SIMIX_WAITING && synchro->state_ != SIMIX_RUNNING)); - if (simcall_execution_test__get__result(simcall)) { + int res = (synchro->state_ != SIMIX_WAITING && synchro->state_ != SIMIX_RUNNING); + if (res) { synchro->simcalls_.push_back(simcall); SIMIX_execution_finish(synchro); } else { SIMIX_simcall_answer(simcall); } - /* If the synchro is already finished then perform the error handling */ - if (synchro->state_ != SIMIX_RUNNING) - SIMIX_execution_finish(synchro); + simcall_execution_test__set__result(simcall, res); } void SIMIX_execution_finish(smx_activity_t synchro) diff --git a/src/simix/smx_network.cpp b/src/simix/smx_network.cpp index 72f03f7c4d..649154b07a 100644 --- a/src/simix/smx_network.cpp +++ b/src/simix/smx_network.cpp @@ -339,19 +339,17 @@ void simcall_HANDLER_comm_test(smx_simcall_t simcall, smx_activity_t synchro) simgrid::kernel::activity::CommImplPtr comm = boost::static_pointer_cast(synchro); + int res; + if (MC_is_active() || MC_record_replay_is_active()){ - simcall_comm_test__set__result(simcall, comm->src_proc && comm->dst_proc); - if (simcall_comm_test__get__result(simcall)){ + res = comm->src_proc && comm->dst_proc; + if (res) synchro->state_ = SIMIX_DONE; - synchro->simcalls_.push_back(simcall); - SIMIX_comm_finish(synchro); - } else { - SIMIX_simcall_answer(simcall); - } - return; + } else { + res = synchro->state_ != SIMIX_WAITING && synchro->state_ != SIMIX_RUNNING; } - simcall_comm_test__set__result(simcall, (synchro->state_ != SIMIX_WAITING && synchro->state_ != SIMIX_RUNNING)); + simcall_comm_test__set__result(simcall, res); if (simcall_comm_test__get__result(simcall)) { synchro->simcalls_.push_back(simcall); SIMIX_comm_finish(synchro);