Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
ContextBoost: use BOOST_VERSION instead of simgrid-specific HAVE_BOOST_CONTEXTS.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 12 Sep 2017 20:03:55 +0000 (22:03 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 12 Sep 2017 21:17:03 +0000 (23:17 +0200)
src/kernel/context/ContextBoost.cpp
src/kernel/context/ContextBoost.hpp

index 2b0bc63..4c3958c 100644 (file)
@@ -154,7 +154,7 @@ BoostContext::BoostContext(std::function<void()> code,
                       smx_context_usable_stack_size,
                       smx_ctx_boost_wrapper);
   } else {
                       smx_context_usable_stack_size,
                       smx_ctx_boost_wrapper);
   } else {
-#if HAVE_BOOST_CONTEXTS == 1
+#if BOOST_VERSION < 105600
     this->fc_ = new boost::context::fcontext_t();
 #endif
     if (BoostContext::maestro_context_ == nullptr)
     this->fc_ = new boost::context::fcontext_t();
 #endif
     if (BoostContext::maestro_context_ == nullptr)
@@ -164,7 +164,7 @@ BoostContext::BoostContext(std::function<void()> code,
 
 BoostContext::~BoostContext()
 {
 
 BoostContext::~BoostContext()
 {
-#if HAVE_BOOST_CONTEXTS == 1
+#if BOOST_VERSION < 105600
   if (not this->stack_)
     delete this->fc_;
 #endif
   if (not this->stack_)
     delete this->fc_;
 #endif
@@ -178,7 +178,7 @@ BoostContext::~BoostContext()
 void BoostContext::resume()
 {
   SIMIX_context_set_current(this);
 void BoostContext::resume()
 {
   SIMIX_context_set_current(this);
-#if HAVE_BOOST_CONTEXTS == 1
+#if BOOST_VERSION < 105600
   boost::context::jump_fcontext(maestro_context_->fc_, this->fc_, reinterpret_cast<intptr_t>(this));
 #else
   boost::context::jump_fcontext(&maestro_context_->fc_, this->fc_, reinterpret_cast<intptr_t>(this));
   boost::context::jump_fcontext(maestro_context_->fc_, this->fc_, reinterpret_cast<intptr_t>(this));
 #else
   boost::context::jump_fcontext(&maestro_context_->fc_, this->fc_, reinterpret_cast<intptr_t>(this));
@@ -202,7 +202,7 @@ void BoostSerialContext::suspend()
     next_context = static_cast<BoostSerialContext*>(maestro_context_);
   }
   SIMIX_context_set_current(static_cast<smx_context_t>(next_context));
     next_context = static_cast<BoostSerialContext*>(maestro_context_);
   }
   SIMIX_context_set_current(static_cast<smx_context_t>(next_context));
-#if HAVE_BOOST_CONTEXTS == 1
+#if BOOST_VERSION < 105600
   boost::context::jump_fcontext(this->fc_, next_context->fc_, reinterpret_cast<pintptr_t>(next_context));
 #else
   boost::context::jump_fcontext(&this->fc_, next_context->fc_, reinterpret_cast<intptr_t>(next_context));
   boost::context::jump_fcontext(this->fc_, next_context->fc_, reinterpret_cast<pintptr_t>(next_context));
 #else
   boost::context::jump_fcontext(&this->fc_, next_context->fc_, reinterpret_cast<intptr_t>(next_context));
@@ -233,7 +233,7 @@ void BoostParallelContext::suspend()
   }
 
   SIMIX_context_set_current(static_cast<smx_context_t>(next_context));
   }
 
   SIMIX_context_set_current(static_cast<smx_context_t>(next_context));
-#if HAVE_BOOST_CONTEXTS == 1
+#if BOOST_VERSION < 105600
   boost::context::jump_fcontext(this->fc_, next_context->fc_, reinterpret_cast<intptr_t>(next_context));
 #else
   boost::context::jump_fcontext(&this->fc_, next_context->fc_, reinterpret_cast<intptr_t>(next_context));
   boost::context::jump_fcontext(this->fc_, next_context->fc_, reinterpret_cast<intptr_t>(next_context));
 #else
   boost::context::jump_fcontext(&this->fc_, next_context->fc_, reinterpret_cast<intptr_t>(next_context));
@@ -255,7 +255,7 @@ void BoostParallelContext::resume()
   workers_context_[worker_id] = worker_context;
 
   SIMIX_context_set_current(this);
   workers_context_[worker_id] = worker_context;
 
   SIMIX_context_set_current(this);
-#if HAVE_BOOST_CONTEXTS == 1
+#if BOOST_VERSION < 105600
   boost::context::jump_fcontext(worker_context->fc_, this->fc_, reinterpret_cast<intptr_t>(this));
 #else
   boost::context::jump_fcontext(&worker_context->fc_, this->fc_, reinterpret_cast<intptr_t>(this));
   boost::context::jump_fcontext(worker_context->fc_, this->fc_, reinterpret_cast<intptr_t>(this));
 #else
   boost::context::jump_fcontext(&worker_context->fc_, this->fc_, reinterpret_cast<intptr_t>(this));
index e8a34c2..9a2a2fb 100644 (file)
@@ -6,6 +6,8 @@
 #ifndef SIMGRID_SIMIX_BOOST_CONTEXT_HPP
 #define SIMGRID_SIMIX_BOOST_CONTEXT_HPP
 
 #ifndef SIMGRID_SIMIX_BOOST_CONTEXT_HPP
 #define SIMGRID_SIMIX_BOOST_CONTEXT_HPP
 
+#include <boost/version.hpp>
+#include <boost/context/fcontext.hpp>
 #include <functional>
 #include <vector>
 
 #include <functional>
 #include <vector>
 
@@ -34,7 +36,7 @@ protected: // static
   static unsigned long process_index_;
   static BoostContext* maestro_context_;
 
   static unsigned long process_index_;
   static BoostContext* maestro_context_;
 
-#if HAVE_BOOST_CONTEXTS == 1
+#if BOOST_VERSION < 105600
   boost::context::fcontext_t* fc_ = nullptr;
 #else
   boost::context::fcontext_t fc_;
   boost::context::fcontext_t* fc_ = nullptr;
 #else
   boost::context::fcontext_t fc_;