Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Align top of stacks to a multiple of 16.
[simgrid.git] / src / kernel / context / ContextBoost.cpp
index d597a45..6c5b2a5 100644 (file)
@@ -30,7 +30,6 @@ public:
       void_pfn_smxprocess_t cleanup_func,
       smx_actor_t process)
     : BoostContext(std::move(code), cleanup_func, process) {}
-  void stop() override;
   void suspend() override;
 };
 
@@ -41,7 +40,6 @@ public:
       void_pfn_smxprocess_t cleanup_func,
       smx_actor_t process)
     : BoostContext(std::move(code), cleanup_func, process) {}
-  void stop() override;
   void suspend() override;
   void resume() override;
 };
@@ -137,8 +135,8 @@ void BoostContext::smx_ctx_boost_wrapper(BoostContext::ctx_arg_type arg)
 #endif
   try {
     (*context)();
-    context->stop();
-  } catch (const StopRequest&) {
+    context->Context::stop();
+  } catch (StopRequest const&) {
     XBT_DEBUG("Caught a StopRequest");
   }
   context->suspend();
@@ -168,7 +166,7 @@ BoostContext::BoostContext(std::function<void()> code,
 // We need to pass the bottom of the stack to make_fcontext, depending on the stack direction it may be the lower
 // or higher address:
 #if PTH_STACKGROWTH == -1
-    void* stack = static_cast<char*>(this->stack_) + smx_context_usable_stack_size - 1;
+    void* stack = static_cast<char*>(this->stack_) + smx_context_usable_stack_size;
 #else
     void* stack = this->stack_;
 #endif
@@ -199,6 +197,12 @@ BoostContext::~BoostContext()
 
 // BoostSerialContext
 
+void BoostContext::stop()
+{
+  Context::stop();
+  throw StopRequest();
+}
+
 void BoostContext::resume()
 {
   SIMIX_context_set_current(this);
@@ -225,12 +229,6 @@ void BoostSerialContext::suspend()
   smx_ctx_boost_jump_fcontext(this, next_context);
 }
 
-void BoostSerialContext::stop()
-{
-  BoostContext::stop();
-  throw StopRequest();
-}
-
 // BoostParallelContext
 
 #if HAVE_THREAD_CONTEXTS
@@ -252,12 +250,6 @@ void BoostParallelContext::suspend()
   smx_ctx_boost_jump_fcontext(this, next_context);
 }
 
-void BoostParallelContext::stop()
-{
-  BoostContext::stop();
-  throw StopRequest();
-}
-
 void BoostParallelContext::resume()
 {
   uintptr_t worker_id = __sync_fetch_and_add(&threads_working_, 1);