X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/c5bf8d0723c36491a1bf37a9f27858b43c4c6e2c..d7fb52aa1f18cd70a51a6d8913c1a4513fea7ce7:/src/kernel/context/ContextSwapped.cpp diff --git a/src/kernel/context/ContextSwapped.cpp b/src/kernel/context/ContextSwapped.cpp index b550205e99..1d18cc5916 100644 --- a/src/kernel/context/ContextSwapped.cpp +++ b/src/kernel/context/ContextSwapped.cpp @@ -55,6 +55,10 @@ SwappedContext::SwappedContext(std::function code, void_pfn_smxprocess_t SwappedContextFactory* factory) : Context(std::move(code), cleanup_func, process), factory_(factory) { + // Save maestro (=context created first) in preparation for run_all + if (factory_->workers_context_[0] == nullptr) + factory_->workers_context_[0] = this; + if (has_code()) { if (smx_context_guard_size > 0 && not MC_is_active()) { @@ -134,12 +138,6 @@ SwappedContext::~SwappedContext() xbt_free(stack_); } -void SwappedContext::set_maestro(SwappedContext* ctx) -{ - if (factory_->threads_working_ == 0) // Don't save the soul of minions, only the one of maestro - factory_->workers_context_[0] = ctx; -} - void* SwappedContext::get_stack() { return stack_;