Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Answer the request as the last action on it (it will destroy it)
[simgrid.git] / src / mc / mc_dpor.c
index 3b2eb2a..18d6814 100644 (file)
@@ -92,9 +92,9 @@ void MC_dpor(void)
           xbt_free(req_str);
         }
 
-        SIMIX_request_pre(req);
-
         MC_state_set_executed_request(state, req);
+
+        SIMIX_request_pre(req); /* After this call req is no longer usefull */
         
         /* Wait for requests (schedules processes) */
         MC_wait_for_requests();
@@ -126,8 +126,9 @@ void MC_dpor(void)
 
       /* Check for deadlocks */
       xbt_swag_foreach(process, simix_global->process_list){
-        if(process->request && !SIMIX_request_is_enabled(process->request)){
-          *mc_exp_ctl = MC_DEADLOCK;
+      /* FIXME: use REQ_NO_REQ instead of NULL for comparison */
+        if(&process->request && !SIMIX_request_is_enabled(&process->request)){
+          MC_show_deadlock(&process->request);
           return;
         }
       }  
@@ -168,17 +169,16 @@ void MC_dpor(void)
           /* We found a back-tracking point, let's loop */
           xbt_fifo_unshift(mc_stack, state);
           DEBUG1("Back-tracking to depth %d", xbt_fifo_size(mc_stack));
-          *mc_exp_ctl = MC_EXPLORE;
           MC_UNSET_RAW_MEM;
-          return;
+          MC_replay(mc_stack);
           break;
         } else {
           MC_state_delete(state);
         }
       }
+      MC_UNSET_RAW_MEM;
     }
   }
   MC_UNSET_RAW_MEM;
-  *mc_exp_ctl = MC_STOP;
   return;
 }