X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/18c57b27dd71ee7839c6a90368c845886a87d638..ae8140f19db6cb86f753e32499eab49190846d1f:/src/simix/smx_network.c diff --git a/src/simix/smx_network.c b/src/simix/smx_network.c index d234bb34ce..db189293bd 100644 --- a/src/simix/smx_network.c +++ b/src/simix/smx_network.c @@ -67,6 +67,11 @@ void SIMIX_rdv_free(void *data) xbt_free(rdv); } +xbt_dict_t SIMIX_get_rdv_points() +{ + return rdv_points; +} + smx_rdv_t SIMIX_rdv_get_by_name(const char *name) { return xbt_dict_get_or_null(rdv_points, name); @@ -149,7 +154,7 @@ smx_action_t SIMIX_rdv_get_comm(smx_rdv_t rdv, e_smx_comm_type_t type, } XBT_DEBUG("Sorry, communication action %p does not match our needs:" " its type is %d but we are looking for a comm of type %d", - action, action->comm.type, type); + action, (int)action->comm.type, (int)type); } XBT_DEBUG("No matching communication action found"); return NULL; @@ -242,7 +247,7 @@ smx_action_t SIMIX_comm_new(e_smx_comm_type_t type) void SIMIX_comm_destroy(smx_action_t action) { XBT_DEBUG("Destroy action %p (refcount: %d), state: %d", - action, action->comm.refcount, action->state); + action, action->comm.refcount, (int)action->state); if (action->comm.refcount <= 0) { xbt_backtrace_display_current(); @@ -564,7 +569,7 @@ XBT_INLINE void SIMIX_comm_start(smx_action_t action) */ void SIMIX_comm_finish(smx_action_t action) { - volatile unsigned int destroy_count = 0; + unsigned int destroy_count = 0; smx_simcall_t simcall; while ((simcall = xbt_fifo_shift(action->simcalls))) { @@ -583,7 +588,7 @@ void SIMIX_comm_finish(smx_action_t action) if (action->comm.rdv) SIMIX_rdv_remove(action->comm.rdv, action); - XBT_DEBUG("SIMIX_comm_finish: action state = %d", action->state); + XBT_DEBUG("SIMIX_comm_finish: action state = %d", (int)action->state); /* Check out for errors */ switch (action->state) { @@ -594,84 +599,56 @@ void SIMIX_comm_finish(smx_action_t action) break; case SIMIX_SRC_TIMEOUT: - TRY { - THROWF(timeout_error, 0, "Communication timeouted because of sender"); - } - CATCH(simcall->issuer->running_ctx->exception) { - simcall->issuer->doexception = 1; - } + SMX_EXCEPTION(simcall->issuer, timeout_error, 0, + "Communication timeouted because of sender"); break; case SIMIX_DST_TIMEOUT: - TRY { - THROWF(timeout_error, 0, "Communication timeouted because of receiver"); - } - CATCH(simcall->issuer->running_ctx->exception) { - simcall->issuer->doexception = 1; - } + SMX_EXCEPTION(simcall->issuer, timeout_error, 0, + "Communication timeouted because of receiver"); break; case SIMIX_SRC_HOST_FAILURE: - TRY { - if (simcall->issuer == action->comm.src_proc) - THROWF(host_error, 0, "Host failed"); - else - THROWF(network_error, 0, "Remote peer failed"); - } - CATCH(simcall->issuer->running_ctx->exception) { - simcall->issuer->doexception = 1; - } + if (simcall->issuer == action->comm.src_proc) + SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed"); + else + SMX_EXCEPTION(simcall->issuer, network_error, 0, "Remote peer failed"); break; case SIMIX_DST_HOST_FAILURE: - TRY { - if (simcall->issuer == action->comm.dst_proc) - THROWF(host_error, 0, "Host failed"); - else - THROWF(network_error, 0, "Remote peer failed"); - } - CATCH(simcall->issuer->running_ctx->exception) { - simcall->issuer->doexception = 1; - } + if (simcall->issuer == action->comm.dst_proc) + SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed"); + else + SMX_EXCEPTION(simcall->issuer, network_error, 0, "Remote peer failed"); break; case SIMIX_LINK_FAILURE: - TRY { - XBT_DEBUG("Link failure in action %p between '%s' and '%s': posting an exception to the issuer: %s (%p) detached:%d", - action, - action->comm.src_proc ? action->comm.src_proc->smx_host->name : NULL, - action->comm.dst_proc ? action->comm.dst_proc->smx_host->name : NULL, - simcall->issuer->name, simcall->issuer, action->comm.detached); - if (action->comm.src_proc == simcall->issuer) { - XBT_DEBUG("I'm source"); - } else if (action->comm.dst_proc == simcall->issuer) { - XBT_DEBUG("I'm dest"); - } else { - XBT_DEBUG("I'm neither source nor dest"); - } - THROWF(network_error, 0, "Link failure"); - } - CATCH(simcall->issuer->running_ctx->exception) { - simcall->issuer->doexception = 1; + XBT_DEBUG("Link failure in action %p between '%s' and '%s': posting an exception to the issuer: %s (%p) detached:%d", + action, + action->comm.src_proc ? action->comm.src_proc->smx_host->name : NULL, + action->comm.dst_proc ? action->comm.dst_proc->smx_host->name : NULL, + simcall->issuer->name, simcall->issuer, action->comm.detached); + if (action->comm.src_proc == simcall->issuer) { + XBT_DEBUG("I'm source"); + } else if (action->comm.dst_proc == simcall->issuer) { + XBT_DEBUG("I'm dest"); + } else { + XBT_DEBUG("I'm neither source nor dest"); } + SMX_EXCEPTION(simcall->issuer, network_error, 0, "Link failure"); break; case SIMIX_CANCELED: - TRY { - if (simcall->issuer == action->comm.dst_proc) { - THROWF(cancel_error, 0, "Communication canceled by the sender"); - } - else { - THROWF(cancel_error, 0, "Communication canceled by the receiver"); - } - } - CATCH(simcall->issuer->running_ctx->exception) { - simcall->issuer->doexception = 1; - } + if (simcall->issuer == action->comm.dst_proc) + SMX_EXCEPTION(simcall->issuer, cancel_error, 0, + "Communication canceled by the sender"); + else + SMX_EXCEPTION(simcall->issuer, cancel_error, 0, + "Communication canceled by the receiver"); break; default: - xbt_die("Unexpected action state in SIMIX_comm_finish: %d", action->state); + xbt_die("Unexpected action state in SIMIX_comm_finish: %d", (int)action->state); } /* if there is an exception during a waitany or a testany, indicate the position of the failed communication */ @@ -721,7 +698,7 @@ void SIMIX_post_comm(smx_action_t action) action->state = SIMIX_DONE; XBT_DEBUG("SIMIX_post_comm: comm %p, state %d, src_proc %p, dst_proc %p, detached: %d", - action, action->state, action->comm.src_proc, action->comm.dst_proc, action->comm.detached); + action, (int)action->state, action->comm.src_proc, action->comm.dst_proc, action->comm.detached); /* destroy the surf actions associated with the Simix communication */ SIMIX_comm_destroy_internal_actions(action);