From: Martin Quinson Date: Mon, 1 Aug 2016 18:54:26 +0000 (+0200) Subject: make SIMIX_context_runall() trivial so that its content can be inlined easily X-Git-Tag: v3_14~656 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/24bfbf4652ba5cbe63f11767a1b9fb14e5508c3a make SIMIX_context_runall() trivial so that its content can be inlined easily --- diff --git a/src/kernel/context/Context.cpp b/src/kernel/context/Context.cpp index fc48824a77..a40fa0c1d4 100644 --- a/src/kernel/context/Context.cpp +++ b/src/kernel/context/Context.cpp @@ -103,8 +103,7 @@ AttachContext::~AttachContext() /** @brief Executes all the processes to run (in parallel if possible). */ void SIMIX_context_runall(void) { - if (!xbt_dynar_is_empty(simix_global->process_to_run)) - simix_global->context_factory->run_all(); + simix_global->context_factory->run_all(); } /** @brief returns the current running context */ diff --git a/src/kernel/context/Context.hpp b/src/kernel/context/Context.hpp index bd4b09517b..45e02236fc 100644 --- a/src/kernel/context/Context.hpp +++ b/src/kernel/context/Context.hpp @@ -44,7 +44,6 @@ namespace kernel { namespace context { class Context; - class ContextFactory; XBT_PUBLIC_CLASS ContextFactory { private: diff --git a/src/kernel/context/ContextBoost.cpp b/src/kernel/context/ContextBoost.cpp index f861f8d1f2..414a476e03 100644 --- a/src/kernel/context/ContextBoost.cpp +++ b/src/kernel/context/ContextBoost.cpp @@ -118,6 +118,8 @@ void BoostContextFactory::run_all() } else #endif { + if (xbt_dynar_is_empty(simix_global->process_to_run)) + return; smx_process_t first_process = xbt_dynar_get_as(simix_global->process_to_run, 0, smx_process_t); BoostContext::process_index_ = 1; diff --git a/src/kernel/context/ContextRaw.cpp b/src/kernel/context/ContextRaw.cpp index 6e13140533..6cbe9f6895 100644 --- a/src/kernel/context/ContextRaw.cpp +++ b/src/kernel/context/ContextRaw.cpp @@ -346,6 +346,9 @@ void RawContextFactory::run_all() void RawContextFactory::run_all_serial() { + if (xbt_dynar_is_empty(simix_global->process_to_run)) + return; + smx_process_t first_process = xbt_dynar_get_as(simix_global->process_to_run, 0, smx_process_t); raw_process_index = 1; diff --git a/src/kernel/context/ContextUnix.cpp b/src/kernel/context/ContextUnix.cpp index 35154dd697..692898d007 100644 --- a/src/kernel/context/ContextUnix.cpp +++ b/src/kernel/context/ContextUnix.cpp @@ -186,12 +186,15 @@ void UContextFactory::run_all() #endif } else { // Serial: - smx_process_t first_process = - xbt_dynar_get_as(simix_global->process_to_run, 0, smx_process_t); - sysv_process_index = 1; - SerialUContext* context = + if (xbt_dynar_is_empty(simix_global->process_to_run)) + return; + + smx_process_t first_process = + xbt_dynar_get_as(simix_global->process_to_run, 0, smx_process_t); + sysv_process_index = 1; + SerialUContext* context = static_cast(first_process->context); - context->resume(); + context->resume(); } }