X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/097a61fa01f109d21c87179ae63061168060905b..d5b91248fa5fef0d3a11b9da3546cf9f1023192a:/src/simix/smx_process.c diff --git a/src/simix/smx_process.c b/src/simix/smx_process.c index d3353c2396..ccd61f541b 100644 --- a/src/simix/smx_process.c +++ b/src/simix/smx_process.c @@ -14,7 +14,9 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_process, simix, "Logging specific to SIMIX (process)"); -static unsigned long simix_process_maxpid = 0; +unsigned long simix_process_maxpid = 0; +/* FIXME: Ugly hack!*/ +extern double NOW; /** * \brief Returns the current agent. @@ -36,7 +38,7 @@ XBT_INLINE smx_process_t SIMIX_process_self(void) void SIMIX_process_cleanup(smx_process_t process) { DEBUG1("Cleanup process %s", process->name); - xbt_swag_remove(process, simix_global->process_to_run); + /*xbt_swag_remove(process, simix_global->process_to_run);*/ xbt_swag_remove(process, simix_global->process_list); xbt_swag_remove(process, process->smx_host->process_list); xbt_swag_insert(process, simix_global->process_to_destroy); @@ -173,7 +175,7 @@ smx_process_t SIMIX_process_create(const char *name, /* Now insert it in the global process list and in the process to run list */ xbt_swag_insert(process, simix_global->process_list); DEBUG2("Inserting %s(%s) in the to_run list", process->name, host->name); - xbt_swag_insert(process, simix_global->process_to_run); + xbt_dynar_push_as(simix_global->process_to_run, smx_process_t, process); } return process; @@ -229,7 +231,7 @@ void SIMIX_process_kill(smx_process_t process, smx_process_t killer) { SIMIX_context_stop(process->context); } else { - xbt_swag_insert(process, simix_global->process_to_run); + xbt_dynar_push_as(simix_global->process_to_run, smx_process_t, process); } } @@ -245,6 +247,8 @@ void SIMIX_process_killall(void) while ((p = xbt_swag_extract(simix_global->process_list))) SIMIX_process_kill(p, SIMIX_process_self()); + SIMIX_context_runall(simix_global->process_to_run); + SIMIX_process_empty_trash(); } @@ -338,7 +342,7 @@ void SIMIX_process_resume(smx_process_t process, smx_process_t issuer) } } else { - xbt_swag_insert(process, simix_global->process_to_run); + xbt_dynar_push_as(simix_global->process_to_run, smx_process_t, process); } } } @@ -401,14 +405,6 @@ int SIMIX_process_is_suspended(smx_process_t process) return process->suspended; } -int SIMIX_process_is_enabled(smx_process_t process) -{ - if (process->request.call != REQ_NO_REQ && SIMIX_request_is_enabled(&process->request)) - return TRUE; - - return FALSE; -} - xbt_dict_t SIMIX_process_get_properties(smx_process_t process) { return process->properties; @@ -417,8 +413,10 @@ xbt_dict_t SIMIX_process_get_properties(smx_process_t process) void SIMIX_pre_process_sleep(smx_req_t req) { if (MC_IS_ENABLED) { + NOW += req->process_sleep.duration; req->process_sleep.result = SIMIX_DONE; SIMIX_request_answer(req); + return; } smx_action_t action = SIMIX_process_sleep(req->issuer, req->process_sleep.duration); xbt_fifo_push(action->request_list, req); @@ -509,8 +507,10 @@ void SIMIX_process_yield(void) /* Ok, maestro returned control to us */ DEBUG1("Maestro returned control to me: '%s'", self->name); - if (self->context->iwannadie) + if (self->context->iwannadie){ + DEBUG0("I wanna die!"); SIMIX_context_stop(self->context); + } if (self->doexception) { DEBUG0("Wait, maestro left me an exception");