X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/fba8541415ef6ede1b56f9b02918a9c4acfde8ad..2e60fe3cfd5cf5305888fcca0ae19700d808bb23:/src/kernel/context/ContextThread.cpp diff --git a/src/kernel/context/ContextThread.cpp b/src/kernel/context/ContextThread.cpp index a9736ccd52..798b05099f 100644 --- a/src/kernel/context/ContextThread.cpp +++ b/src/kernel/context/ContextThread.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2009-2019. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2009-2020. The SimGrid Team. All rights reserved. */ /* 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. */ @@ -22,21 +22,21 @@ namespace context { // ThreadContextFactory -ThreadContextFactory::ThreadContextFactory() : ContextFactory(), parallel_(SIMIX_context_is_parallel()) +ThreadContextFactory::ThreadContextFactory() : ContextFactory() { - if (parallel_) + if (SIMIX_context_is_parallel()) ParallelThreadContext::initialize(); } ThreadContextFactory::~ThreadContextFactory() { - if (parallel_) + if (SIMIX_context_is_parallel()) ParallelThreadContext::finalize(); } ThreadContext* ThreadContextFactory::create_context(std::function&& code, actor::ActorImpl* actor, bool maestro) { - if (parallel_) + if (SIMIX_context_is_parallel()) return this->new_context(std::move(code), actor, maestro); else return this->new_context(std::move(code), actor, maestro); @@ -44,7 +44,7 @@ ThreadContext* ThreadContextFactory::create_context(std::function&& code void ThreadContextFactory::run_all() { - if (parallel_) { + if (SIMIX_context_is_parallel()) { // Parallel execution ParallelThreadContext::run_all(); } else { @@ -158,7 +158,7 @@ void ThreadContext::suspend() void ThreadContext::attach_start() { // We're breaking the layers here by depending on the upper layer: - ThreadContext* maestro = static_cast(simix_global->maestro_process->context_.get()); + ThreadContext* maestro = static_cast(simix_global->maestro_->context_.get()); maestro->begin_.release(); xbt_assert(not this->is_maestro()); this->start(); @@ -169,7 +169,7 @@ void ThreadContext::attach_stop() xbt_assert(not this->is_maestro()); this->yield(); - ThreadContext* maestro = static_cast(simix_global->maestro_process->context_.get()); + ThreadContext* maestro = static_cast(simix_global->maestro_->context_.get()); maestro->end_.acquire(); Context::set_current(nullptr);