From d0f04c9285f21afc7d94ee9a139ba14813186cca Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Thu, 2 Apr 2020 17:02:32 +0200 Subject: [PATCH] fix that example --- examples/s4u/maestro-set/s4u-maestro-set.cpp | 7 ++++--- include/simgrid/simix.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/examples/s4u/maestro-set/s4u-maestro-set.cpp b/examples/s4u/maestro-set/s4u-maestro-set.cpp index 4157f894fd..00982ec997 100644 --- a/examples/s4u/maestro-set/s4u-maestro-set.cpp +++ b/examples/s4u/maestro-set/s4u-maestro-set.cpp @@ -65,6 +65,10 @@ int main(int argc, char* argv[]) { root_id = std::this_thread::get_id(); + /* Specify which code should be executed by maestro on another thread, once this current thread is affected to an + * actor by the subsequent sg_actor_attach(). This must be done before the creation of the engine. */ + SIMIX_set_maestro(maestro, NULL); + simgrid::s4u::Engine e(&argc, argv); if (argc != 2) { @@ -74,9 +78,6 @@ int main(int argc, char* argv[]) e.load_platform(argv[1]); - /* Specify which code should be executed by maestro on another thread, once this current thread is affected to an - * actor by the subsequent sg_actor_attach() */ - SIMIX_set_maestro(maestro, NULL); /* Become one of the simulated process (must be done after the platform creation, or the host won't exist). */ sg_actor_attach("sender", nullptr, simgrid::s4u::Host::by_name("Tremblay"), nullptr); diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index 86372532f1..9264bf53c1 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -39,7 +39,7 @@ XBT_PUBLIC int SIMIX_is_maestro(); /* Initialization and exit */ XBT_PUBLIC void SIMIX_global_init(int* argc, char** argv); -/* Set some code to execute in the maestro +/* Set some code to execute in the maestro (must be used before the engine creation) * * If no maestro code is registered (the default), the main thread * is assumed to be the maestro. */ -- 2.20.1