Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
useless tiny cleanups that should be done all over the place
[simgrid.git] / src / simix / smx_global.c
index eb2a141..da1f2cc 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2007, 2008, 2009, 2010. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2007-2012. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -23,8 +22,6 @@ static void* SIMIX_action_mallocator_new_f(void);
 static void SIMIX_action_mallocator_free_f(void* action);
 static void SIMIX_action_mallocator_reset_f(void* action);
 
-extern void smx_ctx_raw_new_sr(void);
-
 /* FIXME: Yeah, I'll do it in a portable maner one day [Mt] */
 #include <signal.h>
 
@@ -49,6 +46,7 @@ XBT_INLINE double SIMIX_timer_next(void)
 }
 
 /**
+ * \ingroup SIMIX_API
  * \brief Initialize SIMIX internal data.
  *
  * \param argc Argc
@@ -77,6 +75,7 @@ void SIMIX_global_init(int *argc, char **argv)
     simix_global->action_mallocator = xbt_mallocator_new(65536,
         SIMIX_action_mallocator_new_f, SIMIX_action_mallocator_free_f,
         SIMIX_action_mallocator_reset_f);
+    simix_global->autorestart = SIMIX_host_restart_processes;
 
     surf_init(argc, argv);      /* Initialize SURF structures */
     SIMIX_context_mod_init();
@@ -101,6 +100,7 @@ void SIMIX_global_init(int *argc, char **argv)
 }
 
 /**
+ * \ingroup SIMIX_API
  * \brief Clean the SIMIX simulation
  *
  * This functions remove the memory used by SIMIX
@@ -152,6 +152,7 @@ void SIMIX_clean(void)
 
 
 /**
+ * \ingroup SIMIX_API
  * \brief A clock (in second).
  *
  * \return Return the clock.
@@ -178,6 +179,10 @@ static int process_syscall_color(void *p)
   }
 }
 
+/**
+ * \ingroup SIMIX_API
+ * \brief Run the main simulation loop.
+ */
 void SIMIX_run(void)
 {
   double time = 0;
@@ -209,6 +214,11 @@ void SIMIX_run(void)
       /* WARNING, the order *must* be fixed or you'll jeopardize the simulation reproducibility (see RR-7653) */
 
       /* Here, the order is ok because:
+       *
+       *   Short proof: only maestro adds stuff to the process_to_run array, so the execution order of user contexts do not impact its order.
+       *
+       *   Long proof: processes remain sorted through an arbitrary (implicit, complex but fixed) order in all cases.
+       *
        *   - if there is no kill during the simulation, processes remain sorted according by their PID.
        *     rational: This can be proved inductively.
        *        Assume that process_to_run is sorted at a beginning of one round (it is at round 0: the deployment file is parsed linearly).
@@ -305,12 +315,12 @@ void SIMIX_run(void)
 }
 
 /**
- *     \brief Set the date to execute a function
+ *   \brief Set the date to execute a function
  *
  * Set the date to execute the function on the surf.
- *     \param date Date to execute function
- *     \param function Function to be executed
- *     \param arg Parameters of the function
+ *   \param date Date to execute function
+ *   \param function Function to be executed
+ *   \param arg Parameters of the function
  *
  */
 XBT_INLINE void SIMIX_timer_set(double date, void *function, void *arg)
@@ -345,7 +355,7 @@ XBT_INLINE void SIMIX_function_register_process_create(smx_creation_func_t
  *
  * \param function Kill process function
  */
-XBT_INLINE void SIMIX_function_register_process_kill(void_pfn_smxprocess_t
+XBT_INLINE void SIMIX_function_register_process_kill(void_pfn_smxprocess_t_smxprocess_t
                                                      function)
 {
   simix_global->kill_process_function = function;