Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Make MSG action module initialization/finalization an explicit call
authorAugustin Degomme <degomme@idpann.imag.fr>
Thu, 17 Apr 2014 13:54:10 +0000 (15:54 +0200)
committerAugustin Degomme <degomme@idpann.imag.fr>
Fri, 25 Apr 2014 14:08:27 +0000 (16:08 +0200)
This avoid setting up these modules every time, which could cause some issues when mixing

examples/msg/actions/actions.c
include/msg/msg.h
src/msg/msg_actions.c
src/msg/msg_global.c
src/msg/msg_private.h

index ef44344..af24651 100644 (file)
@@ -479,6 +479,9 @@ int main(int argc, char *argv[])
 
   /* Check the given arguments */
   MSG_init(&argc, argv);
+  /* Explicit initialization of the action module is required now*/
+  MSG_action_init();
+
   if (argc < 3) {
     printf("Usage: %s platform_file deployment_file [action_files]\n", argv[0]);
     printf
@@ -522,6 +525,9 @@ int main(int argc, char *argv[])
 
   XBT_INFO("Simulation time %g", MSG_get_clock());
 
+  /* Explicit finalization of the action module is required now*/
+  MSG_action_exit();
+
   if (res == MSG_OK)
     return 0;
   else
index 787df42..9a585fd 100644 (file)
@@ -353,6 +353,8 @@ XBT_PUBLIC(void) MSG_mailbox_set_async(const char *alias);
 
 /************************** Action handling **********************************/
 XBT_PUBLIC(msg_error_t) MSG_action_trace_run(char *path);
+XBT_PUBLIC(void) MSG_action_init(void);
+XBT_PUBLIC(void) MSG_action_exit(void);
 
 #ifdef MSG_USE_DEPRECATED
 
index 93bb48f..6ebb522 100644 (file)
@@ -15,13 +15,13 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_action, msg,
                                 "MSG actions for trace driven simulation");
 
 
-void _MSG_action_init()
+void MSG_action_init()
 {
   _xbt_replay_action_init();
   MSG_function_register_default(xbt_replay_action_runner);
 }
 
-void _MSG_action_exit()
+void MSG_action_exit()
 {
   _xbt_replay_action_exit();
 }
index 9429b10..9511d5e 100644 (file)
@@ -60,9 +60,6 @@ void MSG_init_nocheck(int *argc, char **argv) {
     msg_global->task_copy_callback = NULL;
     msg_global->process_data_cleanup = NULL;
 
-    /* initialization of the action module */
-    _MSG_action_init();
-
     SIMIX_function_register_process_create(MSG_process_create_from_SIMIX);
     SIMIX_function_register_process_cleanup(MSG_process_cleanup_from_SIMIX);
 
@@ -172,12 +169,6 @@ static void MSG_exit(void) {
 
 #ifdef HAVE_TRACING
   TRACE_surf_resource_utilization_release();
-#endif
-
-  /* initialization of the action module */
-  _MSG_action_exit();
-
-#ifdef HAVE_TRACING
   TRACE_end();
 #endif
 
index fadcf96..d461ecc 100644 (file)
@@ -169,9 +169,6 @@ void MSG_process_create_from_SIMIX(smx_process_t *process, const char *name,
                                    smx_process_t parent_process);
 void MSG_comm_copy_data_from_SIMIX(smx_action_t comm, void* buff, size_t buff_size);
 
-void _MSG_action_init(void);
-void _MSG_action_exit(void);
-
 void MSG_post_create_environment(void);
 
 static inline void *msg_host_resource_priv(const void *host) {