X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ec575e854f16278a18a3c5993b7ec9d2aa5bdc0e..7940e7c1b0f2897a82628c707408ad49debd1d3b:/src/simix/ThreadContext.cpp diff --git a/src/simix/ThreadContext.cpp b/src/simix/ThreadContext.cpp index 19be3d43cd..c3a3c0099d 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 */ @@ -11,6 +14,7 @@ #include "xbt/xbt_os_thread.h" #include "src/xbt_modinter.h" /* prototype of os thread module's init/exit in XBT */ +#include "src/simix/smx_private.hpp" #include "src/simix/ThreadContext.hpp" XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_context); @@ -45,22 +49,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)