Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Return the new process in SIMIX_process_restart, simcall_process_restart and MSG_proc...
authorSamuel Lepetit <samuel.lepetit@inria.fr>
Wed, 4 Jul 2012 13:47:19 +0000 (15:47 +0200)
committerSamuel Lepetit <samuel.lepetit@inria.fr>
Wed, 4 Jul 2012 14:31:57 +0000 (16:31 +0200)
include/msg/msg.h
include/simgrid/simix.h
src/msg/msg_process.c
src/simix/smx_process.c
src/simix/smx_process_private.h
src/simix/smx_smurf.c
src/simix/smx_smurf_private.h
src/simix/smx_user.c

index 42a21e7..843c881 100644 (file)
@@ -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,
index e452268..e27cbaa 100644 (file)
@@ -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);
 
index ba3943d..9b8a842 100644 (file)
@@ -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);
 }
index d6aa7da..3e5bafc 100644 (file)
@@ -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;
 }
index dbd1a62..4e65afa 100644 (file)
@@ -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
index 214f022..dfb1268 100644 (file)
@@ -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:
index 27f736e..6e83587 100644 (file)
@@ -306,6 +306,7 @@ typedef struct s_smx_simcall {
 
     struct {
       smx_process_t process;
+      smx_process_t result;
     } process_restart;
 
     struct {
index 004954f..b09d08e 100644 (file)
@@ -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