- simgrid::config::declare_flag<int>("contexts/guard-size", "Guard size for contexts stacks in memory pages",
- default_guard_size,
- [](int value) { smx_context_guard_size = value * xbt_pagesize; });
- simgrid::config::declare_flag<int>("contexts/nthreads", "Number of parallel threads used to execute user contexts", 1,
- &SIMIX_context_set_nthreads);
+ static simgrid::config::Flag<int> 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<int> 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);
+ }};