Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
model-checker : parallel system state comparison for safety MC
[simgrid.git] / src / mc / mc_state.c
index 59cca4e..f0c240d 100644 (file)
@@ -1,4 +1,5 @@
-/* Copyright (c) 2008-2013 Da SimGrid Team. All rights reserved.            */
+/* Copyright (c) 2008-2013. The SimGrid Team.
+ * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -109,12 +110,11 @@ void MC_state_set_executed_request(mc_state_t state, smx_simcall_t req, int valu
 
     case SIMCALL_MC_RANDOM:
       state->internal_req = *req;
-      simcall_mc_random__set__result(&state->internal_req, value);
-      if(value == 0){
+      if(value != simcall_mc_random__get__max(req)){
         xbt_swag_foreach(process, simix_global->process_list){
           procstate = &state->proc_status[process->pid];
           if(process->pid == req->issuer->pid){
-            procstate->state = MC_MORE_INTERLEAVE;  
+            procstate->state = MC_MORE_INTERLEAVE;
             break;
           }        
         }
@@ -200,8 +200,10 @@ smx_simcall_t MC_state_get_request(mc_state_t state, int *value)
           case SIMCALL_MC_RANDOM:
             if(procstate->state == MC_INTERLEAVE)
               *value = 0;
-            else
-              *value = 1;
+            else{
+              if(state->req_num < simcall_mc_random__get__max(&process->simcall))
+                *value = state->req_num + 1;
+            }
             procstate->state = MC_DONE;
             return &process->simcall;
             break;