used even if the OS provide a getline(). This should reduce the
configuration complexity by using the same code on all platforms.
* new xbt_cfg_elm_boolean type
+ * Allow to disable simgrid cleanups at exit from command line option.
+ There are situations where one may want a simulation to end with an exit.
+ Unfortunately, calling exit may cause SimGrid to segfault, which is quite
+ annoying when scripting around the simulator. Adding a
+ --cfg=clean_atexit:yes allows to circumvent this issue.
Java:
* Reintegrate Java to the main archive as desynchronizing these
XBT_DEBUG("ADD MSG LEVELS");
MSG_HOST_LEVEL = xbt_lib_add_level(host_lib, (void_f_pvoid_t) __MSG_host_destroy);
- atexit(MSG_exit);
+ if(sg_cfg_get_boolean("clean_atexit")) atexit(MSG_exit);
}
#ifdef MSG_USE_DEPRECATED
NULL);
#endif // HAVE_SMPI
+ default_value = xbt_strdup("yes");
+ xbt_cfg_register(&_sg_cfg_set, "clean_atexit",
+ "\"yes\" or \"no\". \"yes\" enables all the cleanups of SimGrid (XBT,SIMIX,MSG) to be registered with atexit. \"no\" may be useful if your code segfaults when calling the exit function.",
+ xbt_cfgelm_boolean, &default_value, 1, 1,
+ NULL, NULL);
+ xbt_cfg_setdefault_boolean(_sg_cfg_set, "clean_atexit", default_value);
+
if (!surf_path) {
/* retrieves the current directory of the current process */
const char *initial_path = __surf_get_initial_path();
#include "xbt/str.h"
#include "xbt/ex.h" /* ex_backtrace_display */
#include "mc/mc.h"
+#include "simgrid/sg_config.h"
XBT_LOG_NEW_CATEGORY(simix, "All SIMIX categories");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_kernel, simix,
SIMIX_HOST_LEVEL = xbt_lib_add_level(host_lib,SIMIX_host_destroy);
- atexit(SIMIX_clean);
+ if(sg_cfg_get_boolean("clean_atexit")) atexit(SIMIX_clean);
}
/**
#include "xbt_modinter.h" /* prototype of other module's init/exit in XBT */
+#include "simgrid/sg_config.h"
+
XBT_LOG_NEW_CATEGORY(xbt, "All XBT categories (simgrid toolbox)");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(module, xbt, "module handling");
srand(seed);
srand48(seed);
- atexit(xbt_postexit);
}
static void xbt_postexit(void)
{
+ if(!sg_cfg_get_boolean("clean_atexit")) return;
xbt_backtrace_postexit();
xbt_fifo_postexit();
xbt_dict_postexit();