Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
sanitize the OOP of kernel::profile
[simgrid.git] / src / kernel / context / ContextBoost.cpp
index 56208f7..6153c41 100644 (file)
@@ -23,9 +23,9 @@ smx_context_t BoostContextFactory::create_context(std::function<void()> code, vo
 
 // BoostContext
 
-BoostContext::BoostContext(std::function<void()> code, void_pfn_smxprocess_t cleanup_func, smx_actor_t process,
+BoostContext::BoostContext(std::function<void()> code, void_pfn_smxprocess_t cleanup_func, smx_actor_t actor,
                            SwappedContextFactory* factory)
-    : SwappedContext(std::move(code), cleanup_func, process, factory)
+    : SwappedContext(std::move(code), cleanup_func, actor, factory)
 {
 
   /* if the user provided a function for the process then use it, otherwise it is the context for maestro */
@@ -37,7 +37,6 @@ BoostContext::BoostContext(std::function<void()> code, void_pfn_smxprocess_t cle
 #else
     void* stack = get_stack();
 #endif
-    ASAN_ONLY(this->asan_stack_ = stack);
 #if BOOST_VERSION < 106100
     this->fc_ = boost::context::make_fcontext(stack, smx_context_usable_stack_size, BoostContext::wrapper);
 #else
@@ -45,7 +44,6 @@ BoostContext::BoostContext(std::function<void()> code, void_pfn_smxprocess_t cle
 #endif
 
   } else {
-    set_maestro(this); // save maestro for run_all()
 #if BOOST_VERSION < 105600
     this->fc_ = new boost::context::fcontext_t();
 #endif
@@ -55,7 +53,7 @@ BoostContext::BoostContext(std::function<void()> code, void_pfn_smxprocess_t cle
 BoostContext::~BoostContext()
 {
 #if BOOST_VERSION < 105600
-  if (not this->stack_)
+  if (not get_stack())
     delete this->fc_;
 #endif
 }
@@ -72,13 +70,13 @@ void BoostContext::wrapper(BoostContext::arg_type arg)
 #endif
   try {
     (*context)();
+    context->Context::stop();
   } catch (StopRequest const&) {
     XBT_DEBUG("Caught a StopRequest");
   } catch (simgrid::Exception const& e) {
     XBT_INFO("Actor killed by an uncatched exception %s", simgrid::xbt::demangle(typeid(e).name()).get());
     throw;
   }
-  context->Context::stop();
   ASAN_ONLY(context->asan_stop_ = true);
   context->suspend();
 }