- smx_process_t process = NULL;
- while((process = xbt_setset_set_extract(state->interleave))){
- if(SIMIX_process_is_enabled(process)
- && !xbt_setset_set_belongs(state->done, process)){
- xbt_setset_set_insert(state->done, process);
- return &process->request;
+ unsigned int i;
+ smx_process_t process = NULL;
+ mc_procstate_t procstate = NULL;
+
+ for(i=0; i < state->max_pid; i++){
+ procstate = &state->proc_status[i];
+
+ if(procstate->state == MC_INTERLEAVE){
+
+ if(procstate->num_to_interleave-- > 1)
+ *value = procstate->requests_indexes[procstate->num_to_interleave];
+
+ /* If the are no more requests to interleave for process i then it is done */
+ if(procstate->num_to_interleave == 0)
+ procstate->state = MC_DONE;
+
+ /* FIXME: SIMIX should implement a process table indexed by pid */
+ /* So we should use that instead of traversing the swag */
+ xbt_swag_foreach(process, simix_global->process_list){
+ if(process->pid == i)
+ break;
+ }
+
+ if(SIMIX_process_is_enabled(process))
+ return &process->request;