From: Samuel Lepetit Date: Wed, 4 Jul 2012 13:47:19 +0000 (+0200) Subject: Return the new process in SIMIX_process_restart, simcall_process_restart and MSG_proc... X-Git-Tag: v3_8~337 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/395875ca7134a1860a2f087acd3bdc59b8329ecb Return the new process in SIMIX_process_restart, simcall_process_restart and MSG_process_restart --- diff --git a/include/msg/msg.h b/include/msg/msg.h index 42a21e72ee..843c881e6e 100644 --- a/include/msg/msg.h +++ b/include/msg/msg.h @@ -157,7 +157,7 @@ XBT_PUBLIC(int) MSG_process_is_suspended(msg_process_t process); XBT_PUBLIC(void) MSG_process_on_exit(int_f_pvoid_t fun, void *data); XBT_PUBLIC(void) MSG_process_auto_restart_set(msg_process_t process, int auto_restart); -XBT_PUBLIC(void) MSG_process_restart(msg_process_t process); +XBT_PUBLIC(msg_process_t) MSG_process_restart(msg_process_t process); /************************** Task handling ************************************/ XBT_PUBLIC(msg_task_t) MSG_task_create(const char *name, diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index e45226817f..e27cbaa8c5 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -353,7 +353,7 @@ XBT_PUBLIC(xbt_dict_t) simcall_process_get_properties(smx_process_t host); XBT_PUBLIC(void) simcall_process_set_kill_time(smx_process_t process, double kill_time); XBT_PUBLIC(void) simcall_process_on_exit(smx_process_t process, int_f_pvoid_t fun, void *data); XBT_PUBLIC(void) simcall_process_auto_restart_set(smx_process_t process, int auto_restart); -XBT_PUBLIC(void) simcall_process_restart(smx_process_t process); +XBT_PUBLIC(smx_process_t) simcall_process_restart(smx_process_t process); /* Sleep control */ XBT_PUBLIC(e_smx_state_t) simcall_process_sleep(double duration); diff --git a/src/msg/msg_process.c b/src/msg/msg_process.c index ba3943ddfa..9b8a842d6e 100644 --- a/src/msg/msg_process.c +++ b/src/msg/msg_process.c @@ -503,6 +503,6 @@ XBT_PUBLIC(void) MSG_process_auto_restart_set(msg_process_t process, int auto_re * \ingroup m_process_management * \brief Restarts a process from the beginning. */ -XBT_PUBLIC(void) MSG_process_restart(msg_process_t process) { - simcall_process_restart(process); +XBT_PUBLIC(msg_process_t) MSG_process_restart(msg_process_t process) { + return simcall_process_restart(process); } diff --git a/src/simix/smx_process.c b/src/simix/smx_process.c index d6aa7da289..3e5bafcc7c 100644 --- a/src/simix/smx_process.c +++ b/src/simix/smx_process.c @@ -786,7 +786,7 @@ void SIMIX_process_auto_restart_set(smx_process_t process, int auto_restart) { * \brief Restart a process. * Restart a process, starting it again from the beginning. */ -void SIMIX_process_restart(smx_process_t process, smx_process_t issuer) { +smx_process_t SIMIX_process_restart(smx_process_t process, smx_process_t issuer) { XBT_DEBUG("Restarting process %s on %s", process->name, process->smx_host->name); //retrieve the arguments of the old process //FIXME: Factorise this with SIMIX_host_add_auto_restart_process ? @@ -833,5 +833,5 @@ void SIMIX_process_restart(smx_process_t process, smx_process_t issuer) { arg.auto_restart); } - + return new_process; } diff --git a/src/simix/smx_process_private.h b/src/simix/smx_process_private.h index dbd1a6224b..4e65afa5c7 100644 --- a/src/simix/smx_process_private.h +++ b/src/simix/smx_process_private.h @@ -104,6 +104,6 @@ void SIMIX_process_sleep_suspend(smx_action_t action); void SIMIX_process_sleep_resume(smx_action_t action); void SIMIX_process_sleep_destroy(smx_action_t action); void SIMIX_process_auto_restart_set(smx_process_t process, int auto_restart); -void SIMIX_process_restart(smx_process_t process, smx_process_t issuer); +smx_process_t SIMIX_process_restart(smx_process_t process, smx_process_t issuer); #endif diff --git a/src/simix/smx_smurf.c b/src/simix/smx_smurf.c index 214f0227c0..dfb1268757 100644 --- a/src/simix/smx_smurf.c +++ b/src/simix/smx_smurf.c @@ -365,7 +365,7 @@ void SIMIX_simcall_pre(smx_simcall_t simcall, int value) SIMIX_simcall_answer(simcall); break; case SIMCALL_PROCESS_RESTART: - SIMIX_process_restart(simcall->process_restart.process, simcall->issuer); + simcall->process_restart.result = SIMIX_process_restart(simcall->process_restart.process, simcall->issuer); SIMIX_simcall_answer(simcall); break; case SIMCALL_PROCESS_AUTO_RESTART_SET: diff --git a/src/simix/smx_smurf_private.h b/src/simix/smx_smurf_private.h index 27f736e922..6e83587ede 100644 --- a/src/simix/smx_smurf_private.h +++ b/src/simix/smx_smurf_private.h @@ -306,6 +306,7 @@ typedef struct s_smx_simcall { struct { smx_process_t process; + smx_process_t result; } process_restart; struct { diff --git a/src/simix/smx_user.c b/src/simix/smx_user.c index 004954ff25..b09d08e446 100644 --- a/src/simix/smx_user.c +++ b/src/simix/smx_user.c @@ -684,7 +684,7 @@ XBT_PUBLIC(void) simcall_process_auto_restart_set(smx_process_t process, int aut * \ingroup simix_process_management * \brief Restarts the process, killing it and starting it again from scratch. */ -XBT_PUBLIC(void) simcall_process_restart(smx_process_t process) +XBT_PUBLIC(smx_process_t) simcall_process_restart(smx_process_t process) { smx_simcall_t simcall = SIMIX_simcall_mine(); @@ -692,6 +692,8 @@ XBT_PUBLIC(void) simcall_process_restart(smx_process_t process) simcall->process_restart.process = process; SIMIX_simcall_push(simcall->issuer); + + return simcall->process_restart.result; } /** * \ingroup simix_process_management