X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/62c250035c2cd177abe31131664a623e4d4416aa..090cf2282f07bf598ff25bf0740e35268b20b699:/src/simix/smx_process.c diff --git a/src/simix/smx_process.c b/src/simix/smx_process.c index 49df074f35..b2ec5c1262 100644 --- a/src/simix/smx_process.c +++ b/src/simix/smx_process.c @@ -158,6 +158,10 @@ void SIMIX_process_kill(smx_process_t process) if (process->cond) xbt_swag_remove(process, process->cond->sleeping); + if (process->waiting_action) { + SIMIX_unregister_action_to_condition(process->waiting_action, process->cond); + SIMIX_action_destroy(process->waiting_action); + } SIMIX_context_stop(process->context); } else { DEBUG2("%p here! killing %p", simix_global->current_process, process); @@ -168,6 +172,11 @@ void SIMIX_process_kill(smx_process_t process) if (process->cond) xbt_swag_remove(process, process->cond->sleeping); + + if (process->waiting_action) { + SIMIX_unregister_action_to_condition(process->waiting_action, process->cond); + SIMIX_action_destroy(process->waiting_action); + } } } @@ -301,9 +310,11 @@ void SIMIX_process_suspend(smx_process_t process) cond = SIMIX_cond_init(); dummy = SIMIX_action_execute(SIMIX_process_get_host(process), name, 0); + SIMIX_process_self()->waiting_action = dummy; surf_workstation_model->suspend(dummy->surf_action); SIMIX_register_action_to_condition(dummy, cond); __SIMIX_cond_wait(cond); + SIMIX_process_self()->waiting_action = NULL; SIMIX_unregister_action_to_condition(dummy, cond); SIMIX_action_destroy(dummy); SIMIX_cond_destroy(cond); @@ -401,7 +412,7 @@ void SIMIX_process_yield(void) DEBUG1("Yield process '%s'", simix_global->current_process->name); xbt_assert0((simix_global->current_process != simix_global->maestro_process), - "You are not supposed to run this function here!"); + "You are not supposed to run this function in maestro context!"); SIMIX_context_suspend(simix_global->current_process->context);