From c619840016c55d24574d34f85fa417fcaf60f5d3 Mon Sep 17 00:00:00 2001 From: Takahiro Hirofuchi Date: Thu, 31 Jan 2013 22:21:10 +0100 Subject: [PATCH] fix msg_vm_destroy --- src/msg/msg_vm.c | 52 +++++++++++++++++++++++--------------------- src/simix/smx_user.c | 12 +++++----- src/simix/smx_vm.c | 2 +- 3 files changed, 34 insertions(+), 32 deletions(-) diff --git a/src/msg/msg_vm.c b/src/msg/msg_vm.c index eaa697bb70..ad6a474fea 100644 --- a/src/msg/msg_vm.c +++ b/src/msg/msg_vm.c @@ -296,28 +296,30 @@ void MSG_vm_shutdown(msg_vm_t vm) // xbt_dynar_free(&new_processes); //} // -///** @brief Destroy a msg_vm_t. -// * @ingroup msg_VMs -// */ -//void MSG_vm_destroy(msg_vm_t vm) -//{ -// simcall_vm_destroy(vm); -// -//#if 0 -// unsigned int cpt; -// msg_process_t process; -// xbt_dynar_foreach(vm->processes,cpt,process) { -// //FIXME: Slow ? -// simdata_process_t simdata = simcall_process_get_data(process); -// simdata->vm = NULL; -// } -// -// #ifdef HAVE_TRACING -// TRACE_msg_vm_end(vm); -// #endif -// -// -// xbt_dynar_free(&vm->processes); -// xbt_free(vm); -//#endif -//} + +/** @brief Destroy a VM. + * @ingroup msg_VMs + */ +void MSG_vm_destroy(msg_vm_t vm) +{ + simcall_vm_destroy(vm); + /* TOOD: do we have to do something for processes? */ + +#if 0 + unsigned int cpt; + msg_process_t process; + xbt_dynar_foreach(vm->processes,cpt,process) { + //FIXME: Slow ? + simdata_process_t simdata = simcall_process_get_data(process); + simdata->vm = NULL; + } + + #ifdef HAVE_TRACING + TRACE_msg_vm_end(vm); + #endif + + + xbt_dynar_free(&vm->processes); + xbt_free(vm); +#endif +} diff --git a/src/simix/smx_user.c b/src/simix/smx_user.c index 5c1394fb42..f9cad2c50d 100644 --- a/src/simix/smx_user.c +++ b/src/simix/smx_user.c @@ -282,20 +282,20 @@ e_smx_state_t simcall_host_execution_wait(smx_action_t execution) * \param host A host * \return The properties of this host */ -void* simcall_vm_create(const char *name, smx_host_t phys_host){ +void* simcall_vm_create(const char *name, smx_host_t phys_host) { return simcall_BODY_vm_create(name, phys_host); } - -void simcall_vm_start(smx_host_t vm){ - - simcall_BODY_set_vm_state(vm, msg_vm_state_running); +void simcall_vm_start(smx_host_t vm) +{ + simcall_BODY_set_vm_state(vm, msg_vm_state_running); } void simcall_vm_destroy(smx_host_t vm) { - return simcall_BODY_vm_destroy(vm); + /* will jump to SIMIX_pre_vm_destroy */ + simcall_BODY_vm_destroy(vm); } /** diff --git a/src/simix/smx_vm.c b/src/simix/smx_vm.c index 37c25aafb4..8d82b17f5b 100644 --- a/src/simix/smx_vm.c +++ b/src/simix/smx_vm.c @@ -103,5 +103,5 @@ void SIMIX_vm_destroy(smx_host_t host) } void SIMIX_pre_vm_destroy(smx_simcall_t simcall, smx_host_t vm){ - SIMIX_vm_start(vm); + SIMIX_vm_destroy(vm); } -- 2.20.1