X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a35265d3c8fa860614bab6b7a438ad0cc2803e79..c5d3bb951176d4365811be288a1361de0d374ac1:/src/simgrid/sg_config.c diff --git a/src/simgrid/sg_config.c b/src/simgrid/sg_config.c index 34e5b43f32..b57bc229c1 100644 --- a/src/simgrid/sg_config.c +++ b/src/simgrid/sg_config.c @@ -35,6 +35,12 @@ xbt_cfg_t _sg_cfg_set = NULL; */ 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) { @@ -96,10 +102,8 @@ 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 */ @@ -114,7 +118,7 @@ static void _sg_cfg_cb__workstation_model(const char *name, int pos) if (!strcmp(val, "help")) { model_help("workstation", surf_workstation_model_description); - exit(0); + sg_cfg_exit_early(); } /* Make sure that the model exists */ @@ -133,7 +137,7 @@ static void _sg_cfg_cb__cpu_model(const char *name, int pos) if (!strcmp(val, "help")) { model_help("CPU", surf_cpu_model_description); - exit(0); + sg_cfg_exit_early(); } /* New Module missing */ @@ -152,7 +156,7 @@ static void _sg_cfg_cb__optimization_mode(const char *name, int pos) if (!strcmp(val, "help")) { model_help("optimization", surf_optimization_mode_description); - exit(0); + sg_cfg_exit_early(); } /* New Module missing */ @@ -171,7 +175,7 @@ static void _sg_cfg_cb__storage_mode(const char *name, int pos) if (!strcmp(val, "help")) { model_help("storage", surf_storage_model_description); - exit(0); + sg_cfg_exit_early(); } /* New Module missing */ @@ -190,7 +194,7 @@ static void _sg_cfg_cb__network_model(const char *name, int pos) if (!strcmp(val, "help")) { model_help("network", surf_network_model_description); - exit(0); + sg_cfg_exit_early(); } /* New Module missing */ @@ -243,7 +247,7 @@ static void _sg_cfg_cb__coll(const char *category, if (!strcmp(val, "help")) { coll_help(category, table); - exit(0); + sg_cfg_exit_early(); } /* New Module missing */ @@ -401,7 +405,8 @@ static void _sg_cfg_cb__gtnets_jitter_seed(const char *name, int pos) /* create the config set, register what should be and parse the command line*/ void sg_config_init(int *argc, char **argv) { - char *description = xbt_malloc(1024), *p = description; + char *description = xbt_malloc(1024); + char *p; int i; /* Create the configuration support */ @@ -623,6 +628,8 @@ void sg_config_init(int *argc, char **argv) "Stack size of contexts in Kib", xbt_cfgelm_int, 1, 1, _sg_cfg_cb_context_stack_size, NULL); xbt_cfg_setdefault_int(_sg_cfg_set, "contexts/stack_size", 128); + /* No, it was not set yet (the above setdefault() changed this to 1). */ + smx_context_stack_size_was_set = 0; /* number of parallel threads for user processes */ xbt_cfg_register(&_sg_cfg_set, "contexts/nthreads",