/*******************************************/
XBT_PUBLIC_DATA(xbt_cfg_t) _sg_cfg_set;
XBT_PUBLIC_DATA(int) _sg_cfg_init_status;
+XBT_PUBLIC_DATA(int) _sg_cfg_exit_asap;
XBT_PUBLIC(int) sg_cfg_get_int(const char* name);
XBT_PUBLIC(double) sg_cfg_get_double(const char* name);
XBT_PUBLIC(char*) sg_cfg_get_string(const char* name);
SD_HOST_LEVEL = xbt_lib_add_level(host_lib,__SD_workstation_destroy);
SD_LINK_LEVEL = xbt_lib_add_level(link_lib,__SD_link_destroy);
SD_STORAGE_LEVEL = xbt_lib_add_level(storage_lib,__SD_storage_destroy);
+
+ if (_sg_cfg_exit_asap) {
+ SD_exit();
+ exit(0);
+ }
}
/** \brief set a configuration variable
*/
int _sg_cfg_init_status = 0;
+/* instruct the upper layer (simix or simdag) to exit as soon as possible
+ */
+int _sg_cfg_exit_asap = 0;
+
+#define sg_cfg_exit_early() do { _sg_cfg_exit_asap = 1; return; } while (0)
+
/* Parse the command line, looking for options */
static void sg_config_cmd_line(int *argc, char **argv)
{
argv[j] = NULL;
*argc = j;
}
- if (shall_exit) {
- _sg_cfg_init_status = 1; // get everything cleanly cleaned on exit
- exit(0);
- }
+ if (shall_exit)
+ sg_cfg_exit_early();
}
/* callback of the workstation/model variable */
if (!strcmp(val, "help")) {
model_help("workstation", surf_workstation_model_description);
- exit(0);
+ sg_cfg_exit_early();
}
/* Make sure that the model exists */
if (!strcmp(val, "help")) {
model_help("CPU", surf_cpu_model_description);
- exit(0);
+ sg_cfg_exit_early();
}
/* New Module missing */
if (!strcmp(val, "help")) {
model_help("optimization", surf_optimization_mode_description);
- exit(0);
+ sg_cfg_exit_early();
}
/* New Module missing */
if (!strcmp(val, "help")) {
model_help("storage", surf_storage_model_description);
- exit(0);
+ sg_cfg_exit_early();
}
/* New Module missing */
if (!strcmp(val, "help")) {
model_help("network", surf_network_model_description);
- exit(0);
+ sg_cfg_exit_early();
}
/* New Module missing */
if (!strcmp(val, "help")) {
coll_help(category, table);
- exit(0);
+ sg_cfg_exit_early();
}
/* New Module missing */
SIMIX_HOST_LEVEL = xbt_lib_add_level(host_lib,SIMIX_host_destroy);
- if(sg_cfg_get_boolean("clean_atexit")) atexit(SIMIX_clean);
+ if (sg_cfg_get_boolean("clean_atexit"))
+ atexit(SIMIX_clean);
+
+ if (_sg_cfg_exit_asap)
+ exit(0);
}
/**
*/
static void SIMIX_clean(void)
{
+#ifdef HAVE_TRACING
+ TRACE_end();
+#endif
#ifdef TIME_BENCH_PER_SR
smx_ctx_raw_new_sr();
#endif