Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
More cleanup in contexts' stop().
[simgrid.git] / src / kernel / context / ContextBoost.cpp
index a4c78b3..fa2faf1 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 (StopRequest) {
+    context->Context::stop();
+  } catch (StopRequest const&) {
     XBT_DEBUG("Caught a StopRequest");
   }
   context->suspend();
@@ -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);