Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines with new year.
[simgrid.git] / src / kernel / context / ContextThread.cpp
index a9736cc..798b050 100644 (file)
@@ -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<void()>&& code, actor::ActorImpl* actor, bool maestro)
 {
-  if (parallel_)
+  if (SIMIX_context_is_parallel())
     return this->new_context<ParallelThreadContext>(std::move(code), actor, maestro);
   else
     return this->new_context<SerialThreadContext>(std::move(code), actor, maestro);
@@ -44,7 +44,7 @@ ThreadContext* ThreadContextFactory::create_context(std::function<void()>&& 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<ThreadContext*>(simix_global->maestro_process->context_.get());
+  ThreadContext* maestro = static_cast<ThreadContext*>(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<ThreadContext*>(simix_global->maestro_process->context_.get());
+  ThreadContext* maestro = static_cast<ThreadContext*>(simix_global->maestro_->context_.get());
   maestro->end_.acquire();
 
   Context::set_current(nullptr);