Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
When the process exits, don't cancel the communications it is involved into if it...
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 26 Dec 2011 23:20:56 +0000 (00:20 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 26 Dec 2011 23:20:56 +0000 (00:20 +0100)
src/simix/smx_process.c

index a13e565..f45d326 100644 (file)
@@ -41,8 +41,9 @@ void SIMIX_process_cleanup(smx_process_t process)
   smx_action_t action;
   while ((action = xbt_fifo_pop(process->comms))) {
 
   smx_action_t action;
   while ((action = xbt_fifo_pop(process->comms))) {
 
-    /* make sure no one will finish the comm after this process is destroyed */
-    SIMIX_comm_cancel(action);
+    /* make sure no one will finish the comm after this process is destroyed (unless it's detached) */
+       if (!action->comm.detached || action->comm.src_proc != process)
+               SIMIX_comm_cancel(action);
 
     if (action->comm.src_proc == process) {
       XBT_DEBUG("Found an unfinished send comm %p (detached = %d), state %d, src = %p, dst = %p",
 
     if (action->comm.src_proc == process) {
       XBT_DEBUG("Found an unfinished send comm %p (detached = %d), state %d, src = %p, dst = %p",
@@ -51,15 +52,14 @@ void SIMIX_process_cleanup(smx_process_t process)
 
       if (action->comm.detached) {
          if (action->comm.refcount == 0) {
 
       if (action->comm.detached) {
          if (action->comm.refcount == 0) {
-           XBT_DEBUG("Increase the refcount before destroying it");
+           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);
          }
          XBT_DEBUG("Don't destroy it since its refcount is %d",action->comm.refcount);
            /* 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);
          }
          XBT_DEBUG("Don't destroy it since its refcount is %d",action->comm.refcount);
-      }
-      else {
+      } else {
         SIMIX_comm_destroy(action);
       }
     }
         SIMIX_comm_destroy(action);
       }
     }