X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ee6ffc12bf5523e4d2d2193138c791d991ec0ae4..e98908d4e3ea9f355370a4f0a9db15b9593b7eb1:/src/simix/RawContext.cpp diff --git a/src/simix/RawContext.cpp b/src/simix/RawContext.cpp index 62474794c9..31a950fc7a 100644 --- a/src/simix/RawContext.cpp +++ b/src/simix/RawContext.cpp @@ -13,6 +13,9 @@ #include +#include +#include + #include #include #include @@ -38,8 +41,7 @@ protected: void* stack_top_ = nullptr; public: friend class RawContextFactory; - RawContext(xbt_main_func_t code, - int argc, char **argv, + RawContext(std::function code, void_pfn_smxprocess_t cleanup_func, smx_process_t process); ~RawContext(); @@ -59,10 +61,8 @@ class RawContextFactory : public ContextFactory { public: RawContextFactory(); ~RawContextFactory(); - RawContext* create_context( - xbt_main_func_t, int, char **, void_pfn_smxprocess_t, - smx_process_t process - ) override; + RawContext* create_context(std::function code, + void_pfn_smxprocess_t, smx_process_t process) override; void run_all() override; private: void run_all_adaptative(); @@ -311,12 +311,10 @@ RawContextFactory::~RawContextFactory() #endif } -RawContext* RawContextFactory::create_context( - xbt_main_func_t code, int argc, char ** argv, - void_pfn_smxprocess_t cleanup, - smx_process_t process) +RawContext* RawContextFactory::create_context(std::function code, + void_pfn_smxprocess_t cleanup, smx_process_t process) { - return this->new_context(code, argc, argv, + return this->new_context(std::move(code), cleanup, process); } @@ -327,13 +325,11 @@ void RawContext::wrapper(void* arg) context->stop(); } -RawContext::RawContext( - xbt_main_func_t code, int argc, char ** argv, - void_pfn_smxprocess_t cleanup, - smx_process_t process) - : Context(code, argc, argv, cleanup, process) +RawContext::RawContext(std::function code, + void_pfn_smxprocess_t cleanup, smx_process_t process) + : Context(std::move(code), cleanup, process) { - if (code) { + if (has_code()) { this->stack_ = SIMIX_context_stack_new(); this->stack_top_ = raw_makecontext(this->stack_, smx_context_usable_stack_size,