X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/575dd632d13eabe72bb54342bb4ae09049e251b6..703e8696289393e60554250c2ada4ea97ed89435:/src/simix/smx_global.cpp diff --git a/src/simix/smx_global.cpp b/src/simix/smx_global.cpp index acc00af0fa..1fb67e2a0d 100644 --- a/src/simix/smx_global.cpp +++ b/src/simix/smx_global.cpp @@ -175,6 +175,24 @@ static void SIMIX_storage_create_(smx_storage_t storage) SIMIX_storage_create(key, storage, NULL); } +static std::function maestro_code; + +namespace simgrid { +namespace simix { + +XBT_PUBLIC(void) set_maestro(std::function code) +{ + maestro_code = std::move(code); +} + +} +} + +void SIMIX_set_maestro(void (*code)(void*), void* data) +{ + maestro_code = std::bind(code, data); +} + /** * \ingroup SIMIX_API * \brief Initialize SIMIX internal data. @@ -218,7 +236,10 @@ void SIMIX_global_init(int *argc, char **argv) surf_init(argc, argv); /* Initialize SURF structures */ SIMIX_context_mod_init(); - SIMIX_create_maestro_process(); + + // Either create a new context with maestro or create + // a context object with the current context mestro): + simgrid::simix::create_maestro(maestro_code); /* context exception handlers */ __xbt_running_ctx_fetch = SIMIX_process_get_running_context; @@ -230,8 +251,7 @@ void SIMIX_global_init(int *argc, char **argv) signal(SIGINT, inthandler); #ifndef WIN32 - /* Install SEGV handler */ - install_segvhandler(); + //install_segvhandler(); #endif /* register a function to be called by SURF after the environment creation */ sg_platf_init();