Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Only shutdown the logs when all the XBT users are gone
[simgrid.git] / src / xbt / xbt_main.c
index 927c613..f16ad00 100644 (file)
@@ -31,11 +31,13 @@ xbt_init(int *argc, char **argv) {
   if (xbt_initialized!=1)
     return;
 
-  xbt_binary_name = strdup(argv[0]);
+  xbt_binary_name = xbt_strdup(argv[0]);
   srand((unsigned int)time(NULL));
   VERB0("Initialize XBT");
   
   xbt_log_init(argc,argv);
+  xbt_thread_mod_init();
+  xbt_context_init();
 }
 
 /** @brief Finalize the xbt mechanisms. */
@@ -43,9 +45,14 @@ void
 xbt_exit(){
   xbt_initialized--;
   if (xbt_initialized == 0) {
-    free(xbt_binary_name);
     xbt_fifo_exit();
+    xbt_dict_exit();
+    xbt_context_exit();
+    xbt_thread_mod_exit();
+    xbt_log_exit();
   }
-  xbt_log_exit();
+   
+  if (xbt_initialized == 0)
+    free(xbt_binary_name);
 }