X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ebbf93ef2f2d1164e90a579d18328a570fd67acb..4a6b0a991a67e6f2f67c03fed43529e078da7115:/src/simix/smx_process.cpp diff --git a/src/simix/smx_process.cpp b/src/simix/smx_process.cpp index 65d1f6c271..46007fbaaa 100644 --- a/src/simix/smx_process.cpp +++ b/src/simix/smx_process.cpp @@ -139,10 +139,10 @@ void SIMIX_process_empty_trash(void) } } -/** - * \brief Creates and runs the maestro process - */ -void SIMIX_maestro_create(void (*code)(void*), void* data) +namespace simgrid { +namespace simix { + +void create_maestro(std::function code) { smx_process_t maestro = NULL; /* Create maestro process and intilialize it */ @@ -150,7 +150,7 @@ void SIMIX_maestro_create(void (*code)(void*), void* data) maestro->pid = simix_process_maxpid++; maestro->ppid = -1; maestro->name = (char*) ""; - maestro->data = data; + maestro->data = nullptr; maestro->running_ctx = (xbt_running_ctx_t*) xbt_malloc0(sizeof(xbt_running_ctx_t)); XBT_RUNNING_CTX_INITIALIZE(maestro->running_ctx); @@ -160,14 +160,24 @@ void SIMIX_maestro_create(void (*code)(void*), void* data) if (!simix_global) xbt_die("simix is not initialized, please call MSG_init first"); maestro->context = - simix_global->context_factory->create_maestro( - std::bind(code, data), maestro); + simix_global->context_factory->create_maestro(code, maestro); } maestro->simcall.issuer = maestro; simix_global->maestro_process = maestro; } +} +} + +/** + * \brief Creates and runs the maestro process + */ +void SIMIX_maestro_create(void (*code)(void*), void* data) +{ + simgrid::simix::create_maestro(std::bind(code, data)); +} + /** * \brief Stops a process. *