-
-/**
- * \brief Launch the SIMIX simulation, debug purpose
- */
-void __SIMIX_main(void)
-{
- smx_process_t process = NULL;
- smx_cond_t cond = NULL;
- smx_action_t smx_action;
- xbt_fifo_t actions_done = xbt_fifo_new();
- xbt_fifo_t actions_failed = xbt_fifo_new();
-
- /* Clean IO before the run */
- fflush(stdout);
- fflush(stderr);
-
- //surf_solve(); /* Takes traces into account. Returns 0.0 */
- /* xbt_fifo_size(msg_global->process_to_run) */
-
- while (SIMIX_solve(actions_done, actions_failed) != -1.0) {
-
- while ((smx_action = xbt_fifo_pop(actions_failed))) {
-
- xbt_fifo_item_t _cursor;
-
- DEBUG1("** %s failed **", smx_action->name);
- xbt_fifo_foreach(smx_action->cond_list, _cursor, cond, smx_cond_t) {
- xbt_swag_foreach(process, cond->sleeping) {
- DEBUG2("\t preparing to wake up %s on %s",
- process->name, process->smx_host->name);
- }
- SIMIX_cond_broadcast(cond);
- /* remove conditional from action */
- SIMIX_unregister_action_to_condition(smx_action, cond);
- }
- }
-
- while ((smx_action = xbt_fifo_pop(actions_done))) {
- xbt_fifo_item_t _cursor;
-
- DEBUG1("** %s done **", smx_action->name);
- xbt_fifo_foreach(smx_action->cond_list, _cursor, cond, smx_cond_t) {
- xbt_swag_foreach(process, cond->sleeping) {
- DEBUG2("\t preparing to wake up %s on %s",
- process->name, process->smx_host->name);
- }
- SIMIX_cond_broadcast(cond);
- /* remove conditional from action */
- SIMIX_unregister_action_to_condition(smx_action, cond);
- }
- }
- }
- return;
-}
-
-/**
- * \brief Kill all running process
- * Only maestro can kill everyone :)
- */
-void SIMIX_process_killall()
-{
- smx_process_t p = NULL;
- xbt_assert0((simix_global->current_process ==
- simix_global->maestro_process),
- "You are not supposed to run this function here!");
-
- while ((p = xbt_swag_extract(simix_global->process_list)))
- SIMIX_process_kill(p);
-
- SIMIX_process_empty_trash();
-
- return;
-}
-