- 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;
+
+ for(i=0; i < state->max_pid; i++){
+ if(state->interleave[i] > 0){
+ *value = state->interleave[i]--;
+
+ /* If 0 was reached means that the process is done, so we
+ * set it's value to -1 (the "done" value) */
+ if(state->interleave[i] == 0)
+ state->interleave[i]--;
+
+ /* 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;