A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Try to exit in a more valgrind friendly manner when help is requested.
[simgrid.git]
/
src
/
simgrid
/
sg_config.c
diff --git
a/src/simgrid/sg_config.c
b/src/simgrid/sg_config.c
index
34e5b43
..
5365b64
100644
(file)
--- 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;
*/
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)
{
/* 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;
}
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 */
}
/* 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);
if (!strcmp(val, "help")) {
model_help("workstation", surf_workstation_model_description);
-
exit(0
);
+
sg_cfg_exit_early(
);
}
/* Make sure that the model exists */
}
/* 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);
if (!strcmp(val, "help")) {
model_help("CPU", surf_cpu_model_description);
-
exit(0
);
+
sg_cfg_exit_early(
);
}
/* New Module missing */
}
/* 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);
if (!strcmp(val, "help")) {
model_help("optimization", surf_optimization_mode_description);
-
exit(0
);
+
sg_cfg_exit_early(
);
}
/* New Module missing */
}
/* 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);
if (!strcmp(val, "help")) {
model_help("storage", surf_storage_model_description);
-
exit(0
);
+
sg_cfg_exit_early(
);
}
/* New Module missing */
}
/* 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);
if (!strcmp(val, "help")) {
model_help("network", surf_network_model_description);
-
exit(0
);
+
sg_cfg_exit_early(
);
}
/* New Module missing */
}
/* New Module missing */
@@
-243,7
+247,7
@@
static void _sg_cfg_cb__coll(const char *category,
if (!strcmp(val, "help")) {
coll_help(category, table);
if (!strcmp(val, "help")) {
coll_help(category, table);
-
exit(0
);
+
sg_cfg_exit_early(
);
}
/* New Module missing */
}
/* New Module missing */