XBT_PUBLIC(void) sg_host_simix_set(sg_host_t host, smx_host_priv_t priv);
XBT_PUBLIC(void) sg_host_simix_destroy(sg_host_t host);
-// Module initializer. Won't survive the conversion to C++. Hopefully.
-XBT_PUBLIC(void) sg_host_init(void);
-
// ========= storage related functions ============
XBT_PUBLIC(xbt_dict_t) sg_host_get_mounted_storage_list(sg_host_t host);
XBT_PUBLIC(xbt_dynar_t) sg_host_get_attached_storage_list(sg_host_t host);
simgrid::s4u::Host::onCreation.connect([](simgrid::s4u::Host& host) {
MSG_host_create_(&host);
});
+ MSG_HOST_LEVEL = simgrid::s4u::Host::extension_create([](void *p) {
+ __MSG_host_priv_free((msg_host_priv_t) p);
+ });
+
}
if(MC_is_active()){
// ========= Layering madness ==============*
-#include "src/msg/msg_private.h" // MSG_host_priv_free. FIXME: killme by initializing that level in msg when used
-#include "src/simix/smx_host_private.h" // SIMIX_host_destroy. FIXME: killme by initializing that level in simix when used
#include "src/surf/cpu_interface.hpp"
#include "src/surf/surf_routing.hpp"
-void sg_host_init()
-{
- MSG_HOST_LEVEL = simgrid::s4u::Host::extension_create([](void *p) {
- __MSG_host_priv_free((msg_host_priv_t) p);
- });
-
- SIMIX_HOST_LEVEL = simgrid::s4u::Host::extension_create(SIMIX_host_destroy);
- USER_HOST_LEVEL = simgrid::s4u::Host::extension_create(NULL);
-}
-
// ========== User data Layer ==========
void *sg_host_user(sg_host_t host) {
return host->extension(USER_HOST_LEVEL);
simgrid::s4u::Host::onCreation.connect([](simgrid::s4u::Host& host) {
SIMIX_host_create(&host);
});
+ SIMIX_HOST_LEVEL = simgrid::s4u::Host::extension_create(SIMIX_host_destroy);
+
simgrid::surf::storageCreatedCallbacks.connect([](simgrid::surf::Storage* storage) {
const char* id = storage->getName();
// TODO, create sg_storage_by_name
simgrid::s4u::Host::onDestruction(*host);
delete host;
});
+ USER_HOST_LEVEL = simgrid::s4u::Host::extension_create(NULL);
+
as_router_lib = xbt_lib_new();
storage_lib = xbt_lib_new();
storage_type_lib = xbt_lib_new();
file_lib = xbt_lib_new();
watched_hosts_lib = xbt_dict_new_homogeneous(NULL);
- sg_host_init();
XBT_DEBUG("Add routing levels");
ROUTING_PROP_ASR_LEVEL = xbt_lib_add_level(as_router_lib, NULL);