From 760450d2e6f3a6b6e8fac3d30efe1f848e8097e5 Mon Sep 17 00:00:00 2001 From: Augustin Degomme Date: Thu, 17 Apr 2014 15:54:10 +0200 Subject: [PATCH] Make MSG action module initialization/finalization an explicit call This avoid setting up these modules every time, which could cause some issues when mixing --- examples/msg/actions/actions.c | 6 ++++++ include/msg/msg.h | 2 ++ src/msg/msg_actions.c | 4 ++-- src/msg/msg_global.c | 9 --------- src/msg/msg_private.h | 3 --- 5 files changed, 10 insertions(+), 14 deletions(-) diff --git a/examples/msg/actions/actions.c b/examples/msg/actions/actions.c index ef4434456c..af24651272 100644 --- a/examples/msg/actions/actions.c +++ b/examples/msg/actions/actions.c @@ -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 diff --git a/include/msg/msg.h b/include/msg/msg.h index 787df42f76..9a585fd256 100644 --- a/include/msg/msg.h +++ b/include/msg/msg.h @@ -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 diff --git a/src/msg/msg_actions.c b/src/msg/msg_actions.c index 93bb48f021..6ebb52218d 100644 --- a/src/msg/msg_actions.c +++ b/src/msg/msg_actions.c @@ -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(); } diff --git a/src/msg/msg_global.c b/src/msg/msg_global.c index 9429b10a78..9511d5e150 100644 --- a/src/msg/msg_global.c +++ b/src/msg/msg_global.c @@ -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 diff --git a/src/msg/msg_private.h b/src/msg/msg_private.h index fadcf96b14..d461ecc824 100644 --- a/src/msg/msg_private.h +++ b/src/msg/msg_private.h @@ -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) { -- 2.20.1