Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
inline a bunch of useless functions
authorMartin Quinson <martin.quinson@loria.fr>
Fri, 6 May 2016 20:40:21 +0000 (22:40 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Fri, 6 May 2016 20:41:28 +0000 (22:41 +0200)
src/simix/smx_global.cpp
src/simix/smx_private.hpp
src/simix/smx_process.cpp
src/xbt/parmap.cpp

index d693ac8..9b31320 100644 (file)
@@ -293,7 +293,7 @@ void SIMIX_clean(void)
   simix_global->mutex = NULL;
 
   /* Let's free maestro now */
   simix_global->mutex = NULL;
 
   /* Let's free maestro now */
-  SIMIX_context_free(simix_global->maestro_process->context);
+  delete simix_global->maestro_process->context;
   xbt_free(simix_global->maestro_process->running_ctx);
   xbt_free(simix_global->maestro_process);
   simix_global->maestro_process = NULL;
   xbt_free(simix_global->maestro_process->running_ctx);
   xbt_free(simix_global->maestro_process);
   simix_global->maestro_process = NULL;
index 591265e..abea06b 100644 (file)
 #include "smx_private.h"
 #include "src/simix/popping_private.h"
 
 #include "smx_private.h"
 #include "src/simix/popping_private.h"
 
-/**
- * \brief destroy a context
- * \param context the context to destroy
- * Argument must be stopped first -- runs in maestro context
- */
-static inline void SIMIX_context_free(smx_context_t context)
-{
-  delete context;
-}
-
-/**
- * \brief stops the execution of a context
- * \param context to stop
- */
-static inline void SIMIX_context_stop(smx_context_t context)
-{
-  context->stop();
-}
-
-/**
- \brief suspends a context and return the control back to the one which
-        scheduled it
- \param context the context to be suspended (it must be the running one)
- */
-static inline void SIMIX_context_suspend(smx_context_t context)
-{
-  context->suspend();
-}
-
-/**
- \brief Executes all the processes to run (in parallel if possible).
- */
+/** @brief Executes all the processes to run (in parallel if possible). */
 static inline void SIMIX_context_runall(void)
 {
   if (!xbt_dynar_is_empty(simix_global->process_to_run))
     simix_global->context_factory->run_all();
 }
 
 static inline void SIMIX_context_runall(void)
 {
   if (!xbt_dynar_is_empty(simix_global->process_to_run))
     simix_global->context_factory->run_all();
 }
 
-/**
- \brief returns the current running context
- */
+/** @brief returns the current running context */
 static inline smx_context_t SIMIX_context_self(void)
 {
   if (simix_global && simix_global->context_factory)
 static inline smx_context_t SIMIX_context_self(void)
 {
   if (simix_global && simix_global->context_factory)
index 82b4d16..530d7c9 100644 (file)
@@ -125,7 +125,7 @@ void SIMIX_process_empty_trash(void)
   while ((process = (smx_process_t) xbt_swag_extract(simix_global->process_to_destroy))) {
     XBT_DEBUG("Getting rid of %p",process);
 
   while ((process = (smx_process_t) xbt_swag_extract(simix_global->process_to_destroy))) {
     XBT_DEBUG("Getting rid of %p",process);
 
-    SIMIX_context_free(process->context);
+    delete process->context;
 
     /* Free the exception allocated at creation time */
     free(process->running_ctx);
 
     /* Free the exception allocated at creation time */
     free(process->running_ctx);
@@ -198,8 +198,7 @@ void SIMIX_process_stop(smx_process_t arg) {
                                         arg->auto_restart);
   }
   XBT_DEBUG("Process %s (%s) is dead",arg->name,sg_host_get_name(arg->host));
                                         arg->auto_restart);
   }
   XBT_DEBUG("Process %s (%s) is dead",arg->name,sg_host_get_name(arg->host));
-  /* stop the context */
-  SIMIX_context_stop(arg->context);
+  arg->context->stop();
 }
 
 /**
 }
 
 /**
@@ -925,7 +924,7 @@ void SIMIX_process_yield(smx_process_t self)
   XBT_DEBUG("Yield process '%s'", self->name);
 
   /* Go into sleep and return control to maestro */
   XBT_DEBUG("Yield process '%s'", self->name);
 
   /* Go into sleep and return control to maestro */
-  SIMIX_context_suspend(self->context);
+  self->context->suspend();
 
   /* Ok, maestro returned control to us */
   XBT_DEBUG("Control returned to me: '%s'", self->name);
 
   /* Ok, maestro returned control to us */
   XBT_DEBUG("Control returned to me: '%s'", self->name);
index 028ece1..95abdce 100644 (file)
@@ -290,7 +290,7 @@ static void *xbt_parmap_worker_main(void *arg)
       XBT_DEBUG("Worker %d has finished", data->worker_id);
     /* We are destroying the parmap */
     } else {
       XBT_DEBUG("Worker %d has finished", data->worker_id);
     /* We are destroying the parmap */
     } else {
-      SIMIX_context_free(context);
+      delete context;
       xbt_free(data);
       return NULL;
     }
       xbt_free(data);
       return NULL;
     }