Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
make SIMIX_context_runall() trivial so that its content can be inlined easily
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 1 Aug 2016 18:54:26 +0000 (20:54 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 1 Aug 2016 18:54:26 +0000 (20:54 +0200)
src/kernel/context/Context.cpp
src/kernel/context/Context.hpp
src/kernel/context/ContextBoost.cpp
src/kernel/context/ContextRaw.cpp
src/kernel/context/ContextUnix.cpp

index fc48824..a40fa0c 100644 (file)
@@ -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 */
index bd4b095..45e0223 100644 (file)
@@ -44,7 +44,6 @@ namespace kernel {
 namespace context {
 
   class Context;
-  class ContextFactory;
 
   XBT_PUBLIC_CLASS ContextFactory {
   private:
index f861f8d..414a476 100644 (file)
@@ -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;
index 6e13140..6cbe9f6 100644 (file)
@@ -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;
index 35154dd..692898d 100644 (file)
@@ -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<SerialUContext*>(first_process->context);
-      context->resume();
+    context->resume();
   }
 }