X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/3580b0137eab12ca216d9847823c86918b10dd53..8813202c9b93bd164e386568e895d715af0ac9ee:/src/kernel/context/ContextSwapped.cpp diff --git a/src/kernel/context/ContextSwapped.cpp b/src/kernel/context/ContextSwapped.cpp index 868c19bb80..a4ab5b3558 100644 --- a/src/kernel/context/ContextSwapped.cpp +++ b/src/kernel/context/ContextSwapped.cpp @@ -70,7 +70,7 @@ namespace context { /* thread-specific storage for the worker's context */ thread_local SwappedContext* SwappedContext::worker_context_ = nullptr; -SwappedContext::SwappedContext(std::function&& code, smx_actor_t actor, SwappedContextFactory* factory) +SwappedContext::SwappedContext(std::function&& code, actor::ActorImpl* actor, SwappedContextFactory* factory) : Context(std::move(code), actor, not code /* maestro if no code */), factory_(*factory) { // Save maestro (=first created context) in preparation for run_all @@ -197,7 +197,7 @@ void SwappedContext::swap_into(SwappedContext* to) } /** Maestro wants to run all ready actors */ -void SwappedContextFactory::run_all() +void SwappedContextFactory::run_all(std::vector const& actors_list) { const auto* engine = EngineImpl::get_instance(); /* This function is called by maestro at the beginning of a scheduling round to get all working threads executing some @@ -207,7 +207,7 @@ void SwappedContextFactory::run_all() if (is_parallel()) { // We lazily create the parmap so that all options are actually processed when doing so. if (parmap_ == nullptr) - parmap_ = std::make_unique>(get_nthreads(), get_parallel_mode()); + parmap_ = std::make_unique>(get_nthreads(), get_parallel_mode()); // Usually, Parmap::apply() executes the provided function on all elements of the array. // Here, the executed function does not return the control to the parmap before all the array is processed: @@ -220,9 +220,9 @@ void SwappedContextFactory::run_all() auto* context = static_cast(actor->context_.get()); context->resume(); }, - engine->get_actors_to_run()); + actors_list); } else { // sequential execution - if (not engine->has_actors_to_run()) + if (actors_list.empty()) return; /* maestro is already saved in the first slot of workers_context_ */ @@ -266,7 +266,7 @@ void SwappedContext::suspend() SwappedContext* next_context; if (is_parallel()) { // Get some more work to directly swap into the next executable actor instead of yielding back to the parmap - boost::optional next_work = factory_.parmap_->next(); + boost::optional next_work = factory_.parmap_->next(); if (next_work) { // There is a next soul to embody (ie, another executable actor) XBT_DEBUG("Run next process");