X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/7198a3162eaae82fa2ec5c612d5ae22e243055d7..e36a2202155d007c72d9f54fdddf3f422a8503f8:/src/kernel/context/ContextBoost.cpp diff --git a/src/kernel/context/ContextBoost.cpp b/src/kernel/context/ContextBoost.cpp index d597a45142..6c5b2a5de3 100644 --- a/src/kernel/context/ContextBoost.cpp +++ b/src/kernel/context/ContextBoost.cpp @@ -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 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(this->stack_) + smx_context_usable_stack_size - 1; + void* stack = static_cast(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);