X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ee6ffc12bf5523e4d2d2193138c791d991ec0ae4..6badbbf58554a35b03f58509b0b18cf606c38f5e:/src/simix/ThreadContext.cpp diff --git a/src/simix/ThreadContext.cpp b/src/simix/ThreadContext.cpp index 19be3d43cd..e676dc4ef2 100644 --- a/src/simix/ThreadContext.cpp +++ b/src/simix/ThreadContext.cpp @@ -4,6 +4,9 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ +#include +#include + #include "xbt/function_types.h" #include "smx_private.h" #include "src/portable.h" /* loads context system definitions */ @@ -45,22 +48,19 @@ ThreadContextFactory::~ThreadContextFactory() } ThreadContext* ThreadContextFactory::create_context( - xbt_main_func_t code, int argc, char ** argv, - void_pfn_smxprocess_t cleanup, - smx_process_t process) + std::function code, + void_pfn_smxprocess_t cleanup, smx_process_t process) { - return this->new_context(code, argc, argv, cleanup, process); + return this->new_context(std::move(code), cleanup, process); } -ThreadContext::ThreadContext(xbt_main_func_t code, - int argc, char **argv, - void_pfn_smxprocess_t cleanup, - smx_process_t process) - : Context(code, argc, argv, cleanup, process) +ThreadContext::ThreadContext(std::function code, + void_pfn_smxprocess_t cleanup, smx_process_t process) + : Context(std::move(code), cleanup, process) { /* If the user provided a function for the process then use it otherwise is the context for maestro */ - if (code) { + if (has_code()) { this->begin_ = xbt_os_sem_init(0); this->end_ = xbt_os_sem_init(0); if (smx_context_stack_size_was_set)