X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/c1127bf8323be983d065a03ca485252463389e77..d045730df220c1b78e758d1d7a7fc1c6a53a424f:/src/simix/smx_process.c diff --git a/src/simix/smx_process.c b/src/simix/smx_process.c index 0e31c2e84c..c909ecf899 100644 --- a/src/simix/smx_process.c +++ b/src/simix/smx_process.c @@ -381,6 +381,21 @@ void SIMIX_process_resume(smx_process_t process) } +/** + * \brief Migrates an agent to another location. + * + * This function changes the value of the host on which \a process is running. + */ +void SIMIX_process_change_host(smx_process_t process, char *source, char *dest) +{ + smx_simdata_process_t p_simdata = process->simdata; + smx_host_t h1 = SIMIX_host_get_by_name(source); + smx_host_t h2 = SIMIX_host_get_by_name(dest); + p_simdata->smx_host = h2; + xbt_swag_remove(process, h1->simdata->process_list); + xbt_swag_insert(process, h2->simdata->process_list); +} + /** * \brief Returns true if the process is suspended . *