-#if BOOST_VERSION < 105600
- if (not this->stack_)
- delete this->fc_;
-#endif
- if (this == maestro_context_)
- maestro_context_ = nullptr;
- SIMIX_context_stack_delete(this->stack_);
-}
-
-// BoostSerialContext
-
-void BoostContext::resume()
-{
- SIMIX_context_set_current(this);
-#if BOOST_VERSION < 105600
- boost::context::jump_fcontext(maestro_context_->fc_, this->fc_, reinterpret_cast<intptr_t>(this));
-#else
- boost::context::jump_fcontext(&maestro_context_->fc_, this->fc_, reinterpret_cast<intptr_t>(this));
-#endif
-}
-
-void BoostSerialContext::suspend()
-{
- /* determine the next context */
- BoostSerialContext* next_context = nullptr;
- 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));
-#if BOOST_VERSION < 105600
- boost::context::jump_fcontext(this->fc_, next_context->fc_, reinterpret_cast<pintptr_t>(next_context));
-#else
- boost::context::jump_fcontext(&this->fc_, next_context->fc_, reinterpret_cast<intptr_t>(next_context));
-#endif
-}
-
-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]);
- }
-
- SIMIX_context_set_current(static_cast<smx_context_t>(next_context));
-#if BOOST_VERSION < 105600
- boost::context::jump_fcontext(this->fc_, next_context->fc_, reinterpret_cast<intptr_t>(next_context));