Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix msg_vm_destroy
authorTakahiro Hirofuchi <thirofuchi@debian.(none)>
Thu, 31 Jan 2013 21:21:10 +0000 (22:21 +0100)
committerTakahiro Hirofuchi <thirofuchi@debian.(none)>
Thu, 31 Jan 2013 21:21:10 +0000 (22:21 +0100)
src/msg/msg_vm.c
src/simix/smx_user.c
src/simix/smx_vm.c

index eaa697b..ad6a474 100644 (file)
@@ -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
+}
index 5c1394f..f9cad2c 100644 (file)
@@ -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);
 }
 
 /**
index 37c25aa..8d82b17 100644 (file)
@@ -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);
 }