Otherwise, it would be awaken twice. The first time, it would execute then
wait on the completion of a new simcall. The second time it would appear
to return from the new simcall but the simcall would not have been
executed.
Since resume and kill are particular functions/simcalls that change
the behavior of other process, it is ok if the process was already in the
process_to_run list (although it must not appear twice). For other simcalls,
I think it is invalid if two simcalls lead the scheduling of the same
process.
break;
}
}
-
- xbt_dynar_push_as(simix_global->process_to_run, smx_process_t, process);
+ if(!xbt_dynar_member(simix_global->process_to_run, &(process)))
+ xbt_dynar_push_as(simix_global->process_to_run, smx_process_t, process);
}
/**
}
}
else {
- xbt_dynar_push_as(simix_global->process_to_run, smx_process_t, process);
+ if(!xbt_dynar_member(simix_global->process_to_run, &(process)))
+ xbt_dynar_push_as(simix_global->process_to_run, smx_process_t, process);
}
}
}
XBT_DEBUG("Answer simcall %s (%d) issued by %s (%p)", SIMIX_simcall_name(simcall->call), (int)simcall->call,
simcall->issuer->name, simcall->issuer);
simcall->issuer->simcall.call = SIMCALL_NONE;
- xbt_dynar_push_as(simix_global->process_to_run, smx_process_t, simcall->issuer);
+ if(!xbt_dynar_member(simix_global->process_to_run, &(simcall->issuer)))
+ xbt_dynar_push_as(simix_global->process_to_run, smx_process_t, simcall->issuer);
+ else
+ DIE_IMPOSSIBLE;
}
}