X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d21c9d9527afd7a99ee30e1ace72749025464b95..2f63dce7911dd967b5fd4acadc46a6010c8c0662:/src/xbt/module.c diff --git a/src/xbt/module.c b/src/xbt/module.c index 1398642f10..431203511d 100644 --- a/src/xbt/module.c +++ b/src/xbt/module.c @@ -13,6 +13,7 @@ GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(module,GRAS); extern void gras_log_exit(void); +static int gras_running_process = 0; struct gras_module_ { gras_dynar_t *deps; @@ -58,17 +59,19 @@ gras_init_defaultlog(int *argc,char **argv, const char *defaultlog) { argv[j-1] = NULL; (*argc)--; i--; /* compensate effect of next loop incrementation */ - WARN1("argc %d",*argc); } } if (!found && defaultlog) { TRYFAIL(gras_log_control_set(defaultlog)); } + gras_process_init(); /* calls procdata_init, which calls dynar_new */ /** init other submodules */ - gras_msg_init(); - gras_trp_init(); - gras_datadesc_init(); + if (gras_running_process++ == 0) { + gras_msg_init(); + gras_trp_init(); + gras_datadesc_init(); + } } /** @@ -79,9 +82,12 @@ gras_init_defaultlog(int *argc,char **argv, const char *defaultlog) { void gras_exit(){ INFO0("Exiting GRAS"); - gras_msg_exit(); - gras_trp_exit(); - gras_datadesc_exit(); + gras_process_exit(); + if (--gras_running_process == 0) { + gras_msg_exit(); + gras_trp_exit(); + gras_datadesc_exit(); + } gras_log_exit(); DEBUG0("Exited GRAS"); }