/* int MSG_get_msgload(void); This function lacks specification; discard it */
XBT_PUBLIC(double) MSG_get_host_speed(msg_host_t h);
XBT_PUBLIC(int) MSG_host_is_avail(msg_host_t h);
-XBT_PUBLIC(void) __MSG_host_destroy(msg_host_priv_t host);
+XBT_PUBLIC(void) __MSG_host_priv_free(msg_host_priv_t priv);
+XBT_PUBLIC(void) __MSG_host_destroy(msg_host_t host);
/*property handlers*/
XBT_PUBLIC(xbt_dict_t) MSG_host_get_properties(msg_host_t host);
static int l_host_destroy(lua_State *L)
{
msg_host_t ht = sglua_check_host(L, 1);
- __MSG_host_destroy(MSG_host_priv(ht));
+ __MSG_host_priv_free(MSG_host_priv(ht));
return 0;
}
#endif
XBT_DEBUG("ADD MSG LEVELS");
- MSG_HOST_LEVEL = xbt_lib_add_level(host_lib, (void_f_pvoid_t) __MSG_host_destroy);
+ MSG_HOST_LEVEL = xbt_lib_add_level(host_lib, (void_f_pvoid_t) __MSG_host_priv_free);
atexit(MSG_exit);
}
}
/*
- * \brief Destroys a host (internal call only)
+ * \brief Frees private data of a host (internal call only)
*/
-void __MSG_host_destroy(msg_host_priv_t host) {
-
+void __MSG_host_priv_free(msg_host_priv_t priv)
+{
#ifdef MSG_USE_DEPRECATED
if (msg_global->max_channel > 0)
- free(host->mailboxes);
+ free(priv->mailboxes);
#endif
+ free(priv);
+}
+
+/*
+ * \brief Destroys a host (internal call only)
+ */
+void __MSG_host_destroy(msg_host_t host)
+{
+ const char *name = MSG_host_get_name(host);
/* TODO:
* What happens if VMs still remain on this host?
* Revisit here after the surf layer gets stable.
**/
- free(host);
+ xbt_lib_unset(host_lib, name, MSG_HOST_LEVEL, 1);
}
/** \ingroup m_host_management
#endif
msg_host_t __MSG_host_create(smx_host_t workstation);
-void __MSG_host_destroy(msg_host_priv_t host);
+void __MSG_host_destroy(msg_host_t host);
void MSG_process_cleanup_from_SIMIX(smx_process_t smx_proc);
void MSG_process_create_from_SIMIX(smx_process_t *process, const char *name,
/* Then, destroy the VM object */
simcall_vm_destroy(vm);
+ __MSG_host_destroy(vm);
+
#ifdef HAVE_TRACING
TRACE_msg_vm_end(vm);
#endif