void SIMIX_post_create_environment(void)
{
- void **storage = NULL;
- xbt_lib_cursor_t cursor = NULL;
- char *name = NULL;
-
- /* Create storage at SIMIX level */
- xbt_lib_foreach(storage_lib, cursor, name, storage) {
- if(storage[SURF_STORAGE_LEVEL])
- SIMIX_storage_create(name, storage[SURF_STORAGE_LEVEL], NULL);
- }
-
surf_presolve();
}
SIMIX_process_kill(process, NULL);
}
+static void SIMIX_storage_create_(smx_storage_t storage)
+{
+ const char* key = xbt_dict_get_elm_key(storage);
+ SIMIX_storage_create(key, storage, NULL);
+}
+
/**
* \ingroup SIMIX_API
* \brief Initialize SIMIX internal data.
sg_platf_init();
sg_platf_postparse_add_cb(SIMIX_post_create_environment);
surf_host_created_callback(SIMIX_host_create);
+ surf_storage_created_callback(SIMIX_storage_create_);
}
if (!simix_timers) {
callback(h);
});
}
+
+void surf_storage_created_callback(void (*callback)(sg_storage_t))
+{
+ storageCreatedCallbacks.connect([callback](Storage* storage) {
+ const char* id = storage->getName();
+ // TODO, create sg_storage_by_name
+ sg_storage_t s = xbt_lib_get_elm_or_null(storage_lib, id);
+ xbt_assert(s != NULL, "Storage not found for name %s", id);
+ callback(s);
+ });
+}
#include <xbt/base.h>
#include "simgrid/host.h"
+#include "simgrid/msg.h"
SG_BEGIN_DECL();
XBT_PRIVATE void surf_host_created_callback(void (*callback)(sg_host_t));
+XBT_PRIVATE void surf_storage_created_callback(void (*callback)(sg_storage_t));
SG_END_DECL();