X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ec16845133f5f1b5262d2d77d8ba22824fa8a446..2d103e931b4e47eb04613d0d038b08f5c0a2d004:/src/simix/smx_network.c diff --git a/src/simix/smx_network.c b/src/simix/smx_network.c index 2e81c90d82..c06c6a4fc6 100644 --- a/src/simix/smx_network.c +++ b/src/simix/smx_network.c @@ -244,10 +244,12 @@ void SIMIX_comm_destroy(smx_action_t action) { XBT_DEBUG("Destroy action %p (refcount:%d)", action, action->comm.refcount); - if (action->comm.refcount <= 0) + if (action->comm.refcount <= 0) { + xbt_backtrace_display_current(); xbt_die("the refcount of comm %p is already 0 before decreasing it. " "That's a bug!", action); + } action->comm.refcount--; if (action->comm.refcount > 0) return; @@ -258,10 +260,6 @@ void SIMIX_comm_destroy(smx_action_t action) action->latency_limited = SIMIX_comm_is_latency_bounded( action ) ; #endif -#ifdef HAVE_TRACING - TRACE_smx_action_destroy(action); -#endif - xbt_free(action->name); SIMIX_comm_destroy_internal_actions(action); @@ -336,7 +334,7 @@ smx_action_t SIMIX_comm_isend(smx_process_t src_proc, smx_rdv_t rdv, } SIMIX_comm_start(action); - return action; + return (detached ? NULL : action); } smx_action_t SIMIX_comm_irecv(smx_process_t dst_proc, smx_rdv_t rdv, @@ -530,10 +528,6 @@ XBT_INLINE void SIMIX_comm_start(smx_action_t action) action->state = SIMIX_RUNNING; -#ifdef HAVE_TRACING - TRACE_smx_action_communicate(action, action->comm.src_proc); -#endif - /* If a link is failed, detect it immediately */ if (surf_workstation_model->action_state_get(action->comm.surf_comm) == SURF_ACTION_FAILED) { XBT_DEBUG("Communication from '%s' to '%s' failed to start because of a link failure", @@ -729,6 +723,10 @@ double SIMIX_comm_get_remains(smx_action_t action) { double remains; + if(!action){ + return 0; + } + switch (action->state) { case SIMIX_RUNNING: @@ -789,6 +787,9 @@ smx_process_t SIMIX_comm_get_dst_proc(smx_action_t action) */ XBT_INLINE int SIMIX_comm_is_latency_bounded(smx_action_t action) { + if(!action){ + return 0; + } if (action->comm.surf_comm){ XBT_DEBUG("Getting latency limited for surf_action (%p)", action->comm.surf_comm); action->latency_limited = surf_workstation_model->get_latency_limited(action->comm.surf_comm); @@ -812,7 +813,7 @@ SIMIX_comm_set_copy_data_callback(void (*callback) (smx_action_t, size_t)) void SIMIX_comm_copy_pointer_callback(smx_action_t comm, size_t buff_size) { - xbt_assert1((buff_size == sizeof(void *)), + xbt_assert((buff_size == sizeof(void *)), "Cannot copy %zu bytes: must be sizeof(void*)", buff_size); *(void **) (comm->comm.dst_buff) = comm->comm.src_buff; } @@ -846,10 +847,8 @@ void SIMIX_comm_copy_data(smx_action_t comm) if (comm->comm.dst_buff_size) *comm->comm.dst_buff_size = buff_size; - if (buff_size == 0) - return; - - (*SIMIX_comm_copy_data_callback) (comm, buff_size); + if (buff_size > 0) + (*SIMIX_comm_copy_data_callback) (comm, buff_size); /* Set the copied flag so we copy data only once */ /* (this function might be called from both communication ends) */