X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/afaf38d31c666bd960c0ca714c93c65fbb1a3a6d..d185bae25f7b17fd34cdea9b4f038a021b6f526d:/src/kernel/context/ContextBoost.cpp?ds=inline diff --git a/src/kernel/context/ContextBoost.cpp b/src/kernel/context/ContextBoost.cpp index f39f1d5213..fa2faf195b 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; }; @@ -135,8 +133,13 @@ void BoostContext::smx_ctx_boost_wrapper(BoostContext::ctx_arg_type arg) static_cast(arg.data)[0]->fc_ = arg.fctx; BoostContext* context = static_cast(arg.data)[1]; #endif - (*context)(); - context->stop(); + try { + (*context)(); + context->Context::stop(); + } catch (StopRequest const&) { + XBT_DEBUG("Caught a StopRequest"); + } + context->suspend(); } inline void BoostContext::smx_ctx_boost_jump_fcontext(BoostContext* from, BoostContext* to) @@ -194,6 +197,12 @@ BoostContext::~BoostContext() // BoostSerialContext +void BoostContext::stop() +{ + Context::stop(); + throw StopRequest(); +} + void BoostContext::resume() { SIMIX_context_set_current(this); @@ -220,12 +229,6 @@ void BoostSerialContext::suspend() smx_ctx_boost_jump_fcontext(this, next_context); } -void BoostSerialContext::stop() -{ - BoostContext::stop(); - this->suspend(); -} - // BoostParallelContext #if HAVE_THREAD_CONTEXTS @@ -247,12 +250,6 @@ void BoostParallelContext::suspend() smx_ctx_boost_jump_fcontext(this, next_context); } -void BoostParallelContext::stop() -{ - BoostContext::stop(); - this->suspend(); -} - void BoostParallelContext::resume() { uintptr_t worker_id = __sync_fetch_and_add(&threads_working_, 1);