X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/55092bf3f9fe1cccfe72f7ef81fcd51f9a0eb4ca..f903911759edb23ddddbd427beb6a78f7ff50048:/src/kernel/context/ContextBoost.cpp diff --git a/src/kernel/context/ContextBoost.cpp b/src/kernel/context/ContextBoost.cpp index f861f8d1f2..8fe39e2538 100644 --- a/src/kernel/context/ContextBoost.cpp +++ b/src/kernel/context/ContextBoost.cpp @@ -28,7 +28,7 @@ class BoostSerialContext : public BoostContext { public: BoostSerialContext(std::function code, void_pfn_smxprocess_t cleanup_func, - smx_process_t process) + smx_actor_t process) : BoostContext(std::move(code), cleanup_func, process) {} void stop() override; void suspend() override; @@ -39,7 +39,7 @@ class BoostParallelContext : public BoostContext { public: BoostParallelContext(std::function code, void_pfn_smxprocess_t cleanup_func, - smx_process_t process) + smx_actor_t process) : BoostContext(std::move(code), cleanup_func, process) {} void stop() override; void suspend() override; @@ -87,7 +87,7 @@ BoostContextFactory::~BoostContextFactory() } smx_context_t BoostContextFactory::create_context(std::function code, - void_pfn_smxprocess_t cleanup_func, smx_process_t process) + void_pfn_smxprocess_t cleanup_func, smx_actor_t process) { BoostContext* context = nullptr; if (BoostContext::parallel_) @@ -110,7 +110,7 @@ void BoostContextFactory::run_all() BoostContext::threads_working_ = 0; xbt_parmap_apply(BoostContext::parmap_, [](void* arg) { - smx_process_t process = static_cast(arg); + smx_actor_t process = static_cast(arg); BoostContext* context = static_cast(process->context); return context->resume(); }, @@ -118,8 +118,10 @@ void BoostContextFactory::run_all() } else #endif { - smx_process_t first_process = - xbt_dynar_get_as(simix_global->process_to_run, 0, smx_process_t); + if (xbt_dynar_is_empty(simix_global->process_to_run)) + return; + smx_actor_t first_process = + xbt_dynar_get_as(simix_global->process_to_run, 0, smx_actor_t); BoostContext::process_index_ = 1; /* execute the first process */ static_cast(first_process->context)->resume(); @@ -137,7 +139,7 @@ static void smx_ctx_boost_wrapper(std::intptr_t arg) } BoostContext::BoostContext(std::function code, - void_pfn_smxprocess_t cleanup_func, smx_process_t process) + void_pfn_smxprocess_t cleanup_func, smx_actor_t process) : Context(std::move(code), cleanup_func, process) { @@ -202,7 +204,7 @@ void BoostSerialContext::suspend() /* execute the next process */ XBT_DEBUG("Run next process"); next_context = static_cast(xbt_dynar_get_as( - simix_global->process_to_run, i, smx_process_t)->context); + simix_global->process_to_run, i, smx_actor_t)->context); } else { /* all processes were run, return to maestro */ @@ -232,7 +234,7 @@ void BoostSerialContext::stop() void BoostParallelContext::suspend() { - smx_process_t next_work = (smx_process_t) xbt_parmap_next(parmap_); + smx_actor_t next_work = (smx_actor_t) xbt_parmap_next(parmap_); BoostParallelContext* next_context = nullptr; if (next_work != nullptr) {