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
Initializing logs once and only once.
[simgrid.git]
/
src
/
xbt
/
module.c
diff --git
a/src/xbt/module.c
b/src/xbt/module.c
index
d2a7188
..
0c90ca5
100644
(file)
--- a/
src/xbt/module.c
+++ b/
src/xbt/module.c
@@
-21,35
+21,37
@@
#include "xbt_modinter.h" /* prototype of other module's init/exit in XBT */
#include "gras_modinter.h" /* same in GRAS */
#include "xbt_modinter.h" /* prototype of other module's init/exit in XBT */
#include "gras_modinter.h" /* same in GRAS */
-
GRAS
_LOG_NEW_DEFAULT_SUBCATEGORY(module,xbt, "module handling");
+
XBT
_LOG_NEW_DEFAULT_SUBCATEGORY(module,xbt, "module handling");
-static int
gras
_running_process = 0;
+static int
xbt
_running_process = 0;
-struct
gras
_module_ {
-
gras
_dynar_t *deps;
-
gras
_cfg_t *cfg;
+struct
xbt
_module_ {
+
xbt
_dynar_t *deps;
+
xbt
_cfg_t *cfg;
int ref;
int ref;
-
gras
_module_new_fct_t new;
-
gras
_module_finalize_fct_t finalize;
+
xbt
_module_new_fct_t new;
+
xbt
_module_finalize_fct_t finalize;
};
void
};
void
-gras_init(int *argc, char **argv) {
- gras_init_defaultlog(argc, argv, NULL);
+xbt_init(int *argc, char **argv) {
+ static int first_run = 1;
+ if(first_run)
+ xbt_init_defaultlog(argc, argv, NULL);
+ first_run = 0;
}
/**
}
/**
- *
gras
_init_defaultlog:
+ *
xbt
_init_defaultlog:
* @argc:
* @argv:
*
* Initialize the gras mecanisms.
*/
void
* @argc:
* @argv:
*
* Initialize the gras mecanisms.
*/
void
-
gras
_init_defaultlog(int *argc,char **argv, const char *defaultlog) {
+
xbt
_init_defaultlog(int *argc,char **argv, const char *defaultlog) {
int i,j;
char *opt;
int i,j;
char *opt;
- gras_error_t errcode;
int found=0;
INFO0("Initialize GRAS");
int found=0;
INFO0("Initialize GRAS");
@@
-60,7
+62,7
@@
gras_init_defaultlog(int *argc,char **argv, const char *defaultlog) {
found = 1;
opt=strchr(argv[i],'=');
opt++;
found = 1;
opt=strchr(argv[i],'=');
opt++;
-
gras
_log_control_set(opt);
+
xbt
_log_control_set(opt);
DEBUG1("Did apply '%s' as log setting",opt);
/*remove this from argv*/
for (j=i+1; j<*argc; j++) {
DEBUG1("Did apply '%s' as log setting",opt);
/*remove this from argv*/
for (j=i+1; j<*argc; j++) {
@@
-72,12
+74,12
@@
gras_init_defaultlog(int *argc,char **argv, const char *defaultlog) {
}
}
if (!found && defaultlog) {
}
}
if (!found && defaultlog) {
-
gras
_log_control_set(defaultlog);
+
xbt
_log_control_set(defaultlog);
}
gras_process_init(); /* calls procdata_init, which calls dynar_new */
/** init other submodules */
}
gras_process_init(); /* calls procdata_init, which calls dynar_new */
/** init other submodules */
- if (
gras
_running_process++ == 0) {
+ if (
xbt
_running_process++ == 0) {
gras_msg_init();
gras_trp_init();
gras_datadesc_init();
gras_msg_init();
gras_trp_init();
gras_datadesc_init();
@@
-85,19
+87,19
@@
gras_init_defaultlog(int *argc,char **argv, const char *defaultlog) {
}
/**
}
/**
- *
gras
_exit:
+ *
xbt
_exit:
*
* Finalize the gras mecanisms.
*/
void
*
* Finalize the gras mecanisms.
*/
void
-
gras
_exit(){
+
xbt
_exit(){
INFO0("Exiting GRAS");
gras_process_exit();
INFO0("Exiting GRAS");
gras_process_exit();
- if (--
gras
_running_process == 0) {
+ if (--
xbt
_running_process == 0) {
gras_msg_exit();
gras_trp_exit();
gras_datadesc_exit();
}
gras_msg_exit();
gras_trp_exit();
gras_datadesc_exit();
}
-
gras
_log_exit();
+
xbt
_log_exit();
DEBUG0("Exited GRAS");
}
DEBUG0("Exited GRAS");
}