-/** Yield
- *
- * This function is called when a simulated process wants to yield back to the maestro in a blocking simcall,
- * ie in SIMIX_process_yield().
- *
- * Actually, it does not really yield back to maestro, but directly into the next executable actor.
- *
- * This makes the parmap::apply awkward (see ParallelUContext::run_all()) because it only apply regularly
- * on the few first elements of the array, but it saves a lot of context switches back to maestro,
- * and directly forth to the next executable actor.
- */
-void ParallelUContext::suspend()
-{
- // Get some more work to directly swap into the next executable actor instead of yielding back to the parmap
- boost::optional<smx_actor_t> next_work = parmap_->next();
- SwappedContext* next_context;
- if (next_work) {
- // There is a next soul to embody (ie, another executable actor)
- XBT_DEBUG("Run next process");
- next_context = static_cast<ParallelUContext*>(next_work.get()->context_);
- } else {
- // All actors were run, go back to the parmap context
- XBT_DEBUG("No more processes to run");
- // worker_id_ is the identity of my body, stored in thread_local when starting the scheduling round
- next_context = workers_context_[worker_id_];
- // When given that soul, the body will wait for the next scheduling round