X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/5413861364085b5ed2c3c1fec4bcbf5b7eee530e..992bc1ec57d376cf14b124ea21b58b30f1e162f9:/src/simgrid/sg_config.cpp diff --git a/src/simgrid/sg_config.cpp b/src/simgrid/sg_config.cpp index e60efa33ba..10d160af21 100644 --- a/src/simgrid/sg_config.cpp +++ b/src/simgrid/sg_config.cpp @@ -10,6 +10,7 @@ #include #include "simgrid/sg_config.hpp" +#include "src/include/xbt/mmalloc.h" #include "src/instr/instr_private.hpp" #include "src/internal_config.h" #include "src/kernel/context/Context.hpp" @@ -327,9 +328,17 @@ void sg_config_init(int *argc, char **argv) static simgrid::config::Flag cfg_context_guard_size{ "contexts/guard-size", "Guard size for contexts stacks in memory pages", default_guard_size, [](int value) { simgrid::kernel::context::guard_size = value * xbt_pagesize; }}; - static simgrid::config::Flag cfg_context_nthreads{"contexts/nthreads", - "Number of parallel threads used to execute user contexts", 1, - &simgrid::kernel::context::set_nthreads}; + + static simgrid::config::Flag cfg_context_nthreads{ + "contexts/nthreads", "Number of parallel threads used to execute user contexts", 1, [](int nthreads) { +#if HAVE_MMALLOC + xbt_assert( + nthreads == 1 || !malloc_use_mmalloc(), + "Parallel simulation is forbidden in the verified program, as there is no protection against race " + "conditions in mmalloc itself. Please don't be so greedy and show some mercy for our implementation."); +#endif + simgrid::kernel::context::set_nthreads(nthreads); + }}; /* synchronization mode for parallel user contexts */ #if HAVE_FUTEX_H