void_pfn_smxprocess_t cleanup_func,
smx_actor_t process)
: BoostContext(std::move(code), cleanup_func, process) {}
- void stop() override;
void suspend() override;
};
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;
};
static_cast<BoostContext**>(arg.data)[0]->fc_ = arg.fctx;
BoostContext* context = static_cast<BoostContext**>(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)
// BoostSerialContext
+void BoostContext::stop()
+{
+ Context::stop();
+ throw StopRequest();
+}
+
void BoostContext::resume()
{
SIMIX_context_set_current(this);
smx_ctx_boost_jump_fcontext(this, next_context);
}
-void BoostSerialContext::stop()
-{
- BoostContext::stop();
- this->suspend();
-}
-
// BoostParallelContext
#if HAVE_THREAD_CONTEXTS
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);