Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
improve an error message
[simgrid.git] / src / simix / smx_network.cpp
index 14ebd76..850480f 100644 (file)
@@ -203,8 +203,7 @@ void SIMIX_comm_destroy(smx_synchro_t synchro)
 
   if (comm->refcount <= 0) {
     xbt_backtrace_display_current();
-    xbt_die("The refcount of comm %p is already 0 before decreasing it. "
-            "That's a bug! If you didn't test and/or wait the same communication twice in your code, then the bug is SimGrid's...", synchro);
+    xbt_die("This comm has a negative refcount! You must not call test() or wait() more than once on a given communication.");
   }
   comm->refcount--;
   if (comm->refcount > 0)
@@ -528,13 +527,13 @@ void simcall_HANDLER_comm_test(smx_simcall_t simcall, smx_synchro_t synchro)
 {
   simgrid::simix::Comm *comm = static_cast<simgrid::simix::Comm*>(synchro);
 
-  if(MC_is_active() || MC_record_replay_is_active()){
+  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)){
+    if (simcall_comm_test__get__result(simcall)){
       synchro->state = SIMIX_DONE;
       xbt_fifo_push(synchro->simcalls, simcall);
       SIMIX_comm_finish(synchro);
-    }else{
+    } else {
       SIMIX_simcall_answer(simcall);
     }
     return;
@@ -613,9 +612,8 @@ void SIMIX_waitany_remove_simcall_from_actions(smx_simcall_t simcall)
   unsigned int cursor = 0;
   xbt_dynar_t synchros = simcall_comm_waitany__get__comms(simcall);
 
-  xbt_dynar_foreach(synchros, cursor, synchro) {
+  xbt_dynar_foreach(synchros, cursor, synchro)
     xbt_fifo_remove(synchro->simcalls, simcall);
-  }
 }
 
 /**
@@ -834,24 +832,6 @@ void SIMIX_post_comm(smx_synchro_t synchro)
   }
 }
 
-void SIMIX_comm_cancel(smx_synchro_t synchro)
-{
-  simgrid::simix::Comm *comm = static_cast<simgrid::simix::Comm*>(synchro);
-
-  /* if the synchro is a waiting state means that it is still in a mbox */
-  /* so remove from it and delete it */
-  if (comm->state == SIMIX_WAITING) {
-    SIMIX_mbox_remove(comm->mbox, synchro);
-    comm->state = SIMIX_CANCELED;
-  }
-  else if (!MC_is_active() /* when running the MC there are no surf actions */
-           && !MC_record_replay_is_active()
-           && (comm->state == SIMIX_READY || comm->state == SIMIX_RUNNING)) {
-
-    comm->surf_comm->cancel();
-  }
-}
-
 /************* synchro Getters **************/
 
 /**