Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Found a bug/feature regarding the cancellation of a sleep (see comments directly...
[simgrid.git] / src / simix / smx_process.c
index 32c7075..84bcef1 100644 (file)
@@ -64,20 +64,12 @@ void SIMIX_process_cleanup(smx_process_t process)
           action, action->comm.detached, (int)action->state, action->comm.src_proc, action->comm.dst_proc);
       action->comm.src_proc = NULL;
 
-      if (action->comm.detached) {
-         if (action->comm.refcount == 0) {
-           XBT_DEBUG("Increase the refcount before destroying it since it's detached");
-           /* I'm not supposed to destroy a detached comm from the sender side,
-            * unless there is no receiver matching the rdv */
-           action->comm.refcount++;
-           SIMIX_comm_destroy(action);
-         }
-         else {
-           XBT_DEBUG("Don't destroy it since its refcount is %d", action->comm.refcount);
-         }
-      } else {
+      /* I'm not supposed to destroy a detached comm from the sender side, */
+      if (!action->comm.detached)
         SIMIX_comm_destroy(action);
-      }
+      else
+        XBT_DEBUG("Don't destroy it since it's a detached comm");
+
     }
     else if (action->comm.dst_proc == process){
       XBT_DEBUG("Found an unfinished recv comm %p, state %d, src = %p, dst = %p",
@@ -767,7 +759,7 @@ void SIMIX_post_process_sleep(smx_action_t action)
     switch(surf_action_get_state(action->sleep.surf_sleep)){
       case SURF_ACTION_FAILED:
         simcall->issuer->context->iwannadie = 1;
-        //SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed");
+       //SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed");
         state = SIMIX_SRC_HOST_FAILURE;
         break;
 
@@ -848,6 +840,7 @@ void SIMIX_process_yield(smx_process_t self)
   if (self->context->iwannadie){
     XBT_DEBUG("I wanna die!");
     SIMIX_process_stop(self);
+    XBT_DEBUG("SIMIX Stop done");
   }
 
   if (self->suspended) {