Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Kill old implementation of SIMIX_process_self.
[simgrid.git] / src / simix / smx_process.c
index 7272966..5cf98a1 100644 (file)
@@ -15,6 +15,20 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_process, simix,
 
 static unsigned long simix_process_count = 0;
 
+/**
+ * \brief Returns the current agent.
+ *
+ * This functions returns the currently running SIMIX process.
+ *
+ * \return The SIMIX process
+ */
+XBT_INLINE smx_process_t SIMIX_process_self(void)
+{
+  if(simix_global)
+    return SIMIX_context_get_data(SIMIX_context_self());
+  return NULL;
+}
+
 /**
  * \brief Move a process to the list of processes to destroy.
  */
@@ -68,7 +82,6 @@ void SIMIX_create_maestro_process()
   maestro->context = SIMIX_context_new(NULL, 0, NULL, NULL, maestro);
 
   simix_global->maestro_process = maestro;
-  simix_global->current_process = maestro;
   
   return;
 }
@@ -462,7 +475,7 @@ void SIMIX_process_sleep_destroy(smx_action_t action)
   if (action->sleep.surf_sleep)
     action->sleep.surf_sleep->model_type->action_unref(action->sleep.surf_sleep);
 #ifdef HAVE_TRACING
-  TRACE_smx_action_destroy(act);
+  TRACE_smx_action_destroy(action);
 #endif
   xbt_fifo_free(action->request_list);
   xbt_free(action);
@@ -478,20 +491,6 @@ void SIMIX_process_sleep_resume(smx_action_t action)
   surf_workstation_model->resume(action->sleep.surf_sleep);
 }
 
-/**
- * \brief Returns the current agent.
- *
- * This functions returns the currently running SIMIX process.
- *
- * \return The SIMIX process
- */
-XBT_INLINE smx_process_t SIMIX_process_self(void)
-{
-  if(simix_global)
-    return SIMIX_context_self();
-  return NULL;
-}
-
 /** 
  * Calling this function makes the process to yield.
  * Only the processes can call this function, giving back the control to maestro
@@ -521,7 +520,7 @@ void SIMIX_process_yield(void)
 /* callback: context fetching */
 xbt_running_ctx_t *SIMIX_process_get_running_context(void)
 {
-  return simix_global->current_process->running_ctx;
+  return SIMIX_process_self()->running_ctx;
 }
 
 /* callback: termination */