}
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;
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();
*/
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))) {
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) {
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 */
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);