- while (surf_timer_resource->extension_public->get(&fun,(void*)&arg)) {
- DEBUG2("got %p %p", fun, arg);
- if(fun==SIMIX_process_create_with_arguments) {
- process_arg_t args = arg;
- DEBUG2("Launching %s on %s", args->name, args->host->name);
- process = SIMIX_process_create_with_arguments(args->name, args->code,
- args->data, args->host,
- args->argc,args->argv);
- if(args->kill_time > SIMIX_get_clock()) {
- surf_timer_resource->extension_public->set(args->kill_time,
- (void*) &SIMIX_process_kill,
- (void*) process);
- }
- xbt_free(args);
- }
- if(fun==SIMIX_process_kill) {
- process = arg;
- DEBUG2("Killing %s on %s", process->name,
- process->simdata->host->name);
- SIMIX_process_kill(process);
- }
- }
-
- /* Wake up all process waiting for the action finish */
- xbt_dynar_foreach(resource_list, i, resource) {
- while ((action =
- xbt_swag_extract(resource->common_public->states.
- failed_action_set))) {
- smx_action = action->data;
- if (smx_action) {
- xbt_fifo_item_t _cursor;
-
- DEBUG1("** %s failed **",smx_action->name);
- /* put all the process that are waiting in a conditional (dummy action) on the process_to_run list */
- if ( smx_action->simdata->action_block) {
- xbt_swag_insert(smx_action->simdata->cond_process,simix_global->process_to_run);
- }
- /* else, do the dummy action finish, call the signal broadcast */
- else {
- xbt_fifo_foreach(smx_action->simdata->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->simdata->host->name);
- }
- SIMIX_cond_broadcast(cond);
- /* remove conditional from action */
- xbt_fifo_remove(smx_action->simdata->cond_list,cond);
- }
- }
- process=NULL;
- }
- }
- while ((action =
- xbt_swag_extract(resource->common_public->states.
- done_action_set))) {
- smx_action = action->data;
- if (smx_action) {
- xbt_fifo_item_t _cursor;
-
- DEBUG1("** %s done **",smx_action->name);
- /* put all the process that are waiting in a conditional (dummy action) on the process_to_run list */
- if ( smx_action->simdata->action_block) {
- if (smx_action->simdata->timeout_cond) {
- xbt_swag_remove(smx_action->simdata->cond_process,smx_action->simdata->timeout_cond->sleeping);
- }
- process = smx_action->simdata->cond_process;
- xbt_swag_insert(smx_action->simdata->cond_process,simix_global->process_to_run);
- DEBUG2("\t preparing to wake up %s on %s",
- process->name, process->simdata->host->name);
- }
- /* else, do the dummy action finish, call the signal broadcast */
- else {
- xbt_fifo_foreach(smx_action->simdata->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->simdata->host->name);
- }
- SIMIX_cond_broadcast(cond);
- /* remove conditional from action */
- xbt_fifo_remove(smx_action->simdata->cond_list,cond);
- }
- }
- process=NULL;
- }
-/*
- if (smx_action) {
- xbt_fifo_item_t _cursor;
-
- DEBUG1("** %s done **",smx_action->name);
- xbt_fifo_foreach(smx_action->simdata->cond_list,_cursor,cond,smx_cond_t) {
- SIMIX_cond_broadcast(cond);
- xbt_swag_foreach(process,cond->sleeping) {
- DEBUG2("\t preparing to wake up %s on %s",
- process->name, process->simdata->host->name);
- }
- }
- process=NULL;
- }*/