- if (this == maestro_context_)
- maestro_context_ = nullptr;
- SIMIX_context_stack_delete(this->stack_);
-}
-
-// BoostSerialContext
-
-void BoostContext::resume()
-{
- SIMIX_context_set_current(this);
- smx_ctx_boost_jump_fcontext(maestro_context_, this);
-}
-
-void BoostSerialContext::suspend()
-{
- /* determine the next context */
- BoostSerialContext* next_context;
- unsigned long int i = process_index_;
- process_index_++;
-
- if (i < simix_global->process_to_run.size()) {
- /* execute the next process */
- XBT_DEBUG("Run next process");
- next_context = static_cast<BoostSerialContext*>(simix_global->process_to_run[i]->context);
- } else {
- /* all processes were run, return to maestro */
- XBT_DEBUG("No more process to run");
- next_context = static_cast<BoostSerialContext*>(maestro_context_);
- }
- SIMIX_context_set_current(static_cast<smx_context_t>(next_context));
- smx_ctx_boost_jump_fcontext(this, next_context);
-}
-
-void BoostSerialContext::stop()
-{
- BoostContext::stop();
- this->suspend();
-}
-
-// BoostParallelContext
-
-#if HAVE_THREAD_CONTEXTS
-
-void BoostParallelContext::suspend()
-{
- boost::optional<smx_actor_t> next_work = parmap_->next();
- BoostParallelContext* next_context;
- if (next_work) {
- XBT_DEBUG("Run next process");
- next_context = static_cast<BoostParallelContext*>(next_work.get()->context);
- } else {
- XBT_DEBUG("No more processes to run");
- uintptr_t worker_id = reinterpret_cast<uintptr_t>(xbt_os_thread_get_specific(worker_id_key_));
- next_context = static_cast<BoostParallelContext*>(workers_context_[worker_id]);
+ try {
+ (*context)();
+ context->Context::stop();
+ } catch (ForcefulKillException const&) {
+ XBT_DEBUG("Caught a ForcefulKillException");
+ } catch (simgrid::Exception const& e) {
+ XBT_INFO("Actor killed by an uncaught exception %s", simgrid::xbt::demangle(typeid(e).name()).get());
+ throw;