Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
cleanups in mailbox module init/fini
authorMartin Quinson <martin.quinson@loria.fr>
Thu, 21 Apr 2016 18:21:57 +0000 (20:21 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Thu, 21 Apr 2016 18:21:57 +0000 (20:21 +0200)
src/simix/smx_global.cpp
src/simix/smx_network.cpp
src/simix/smx_network_private.h

index d039e8c..6e71f22 100644 (file)
@@ -230,8 +230,6 @@ void SIMIX_global_init(int *argc, char **argv)
     __xbt_running_ctx_fetch = SIMIX_process_get_running_context;
     __xbt_ex_terminate = SIMIX_process_exception_terminate;
 
-    SIMIX_network_init();
-
     /* Prepare to display some more info when dying on Ctrl-C pressing */
     signal(SIGINT, inthandler);
 
@@ -298,7 +296,7 @@ void SIMIX_clean(void)
   SIMIX_process_killall(simix_global->maestro_process, 1);
 
   /* Exit the SIMIX network module */
-  SIMIX_network_exit();
+  SIMIX_mailbox_exit();
 
   xbt_heap_free(simix_timers);
   simix_timers = NULL;
index 977fe43..b1cf01d 100644 (file)
 #include "mc/mc.h"
 #include "src/mc/mc_replay.h"
 #include "xbt/dict.h"
+#include "simgrid/s4u/mailbox.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_network, simix, "SIMIX network-related synchronization");
 
-static xbt_dict_t mailboxes = NULL;
+static void SIMIX_mbox_free(void *data);
+static xbt_dict_t mailboxes = xbt_dict_new_homogeneous(SIMIX_mbox_free);
 
 static void SIMIX_waitany_remove_simcall_from_actions(smx_simcall_t simcall);
 static void SIMIX_comm_copy_data(smx_synchro_t comm);
@@ -25,15 +27,9 @@ static smx_synchro_t SIMIX_fifo_probe_comm(xbt_fifo_t fifo, e_smx_comm_type_t ty
 static smx_synchro_t SIMIX_fifo_get_comm(xbt_fifo_t fifo, e_smx_comm_type_t type,
                                         int (*match_fun)(void *, void *,smx_synchro_t),
                                         void *user_data, smx_synchro_t my_synchro);
-static void SIMIX_mbox_free(void *data);
 static void SIMIX_comm_start(smx_synchro_t synchro);
 
-void SIMIX_network_init(void)
-{
-  mailboxes = xbt_dict_new_homogeneous(SIMIX_mbox_free);
-}
-
-void SIMIX_network_exit(void)
+void SIMIX_mailbox_exit(void)
 {
   xbt_dict_free(&mailboxes);
 }
index f2a93b8..0484c4b 100644 (file)
@@ -21,8 +21,7 @@ typedef struct s_smx_mailbox {
   xbt_fifo_t done_comm_fifo;//messages already received in the permanent receive mode
 } s_smx_mailbox_t;
 
-XBT_PRIVATE void SIMIX_network_init(void);
-XBT_PRIVATE void SIMIX_network_exit(void);
+XBT_PRIVATE void SIMIX_mailbox_exit(void);
 
 XBT_PRIVATE smx_mailbox_t SIMIX_mbox_create(const char *name);
 XBT_PRIVATE void SIMIX_mbox_destroy(smx_mailbox_t mbox);