From ed3e911d18757096ccfd585c4f8ef09d8589f249 Mon Sep 17 00:00:00 2001 From: Augustin Degomme Date: Tue, 4 Feb 2014 16:51:10 +0100 Subject: [PATCH] ensure processes are still alive before altering their communications from another one --- src/simix/smx_network.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/simix/smx_network.c b/src/simix/smx_network.c index dd3660a851..0de05fa5d7 100644 --- a/src/simix/smx_network.c +++ b/src/simix/smx_network.c @@ -792,6 +792,7 @@ void SIMIX_comm_finish(smx_action_t action) unsigned int destroy_count = 0; smx_simcall_t simcall; + while ((simcall = xbt_fifo_shift(action->simcalls))) { /* If a waitany simcall is waiting for this action to finish, then remove @@ -890,13 +891,33 @@ void SIMIX_comm_finish(smx_action_t action) simcall->issuer->waiting_action = NULL; xbt_fifo_remove(simcall->issuer->comms, action); if(action->comm.detached){ + smx_process_t proc; + int still_alive = 0; + if(simcall->issuer == action->comm.src_proc){ - if(action->comm.dst_proc) - xbt_fifo_remove(action->comm.dst_proc->comms, action); + if(action->comm.dst_proc){ + xbt_swag_foreach(proc, simix_global->process_list) + { + if(proc==action->comm.dst_proc){ + still_alive=1; + break; + } + } + } + if(still_alive) xbt_fifo_remove(action->comm.dst_proc->comms, action); } if(simcall->issuer == action->comm.dst_proc){ if(action->comm.src_proc) - xbt_fifo_remove(action->comm.src_proc->comms, action); + if(action->comm.dst_proc){ + xbt_swag_foreach(proc, simix_global->process_list) + { + if(proc==action->comm.src_proc){ + still_alive=1; + break; + } + } + } + if(still_alive) xbt_fifo_remove(action->comm.src_proc->comms, action); } } SIMIX_simcall_answer(simcall); -- 2.20.1