Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Make config flag static (global), and rename s_MSG_Global_t.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 25 Mar 2019 14:31:14 +0000 (15:31 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 26 Mar 2019 14:21:30 +0000 (15:21 +0100)
src/msg/msg_global.cpp
src/msg/msg_private.hpp

index a985757..5b6713b 100644 (file)
@@ -14,7 +14,9 @@
 XBT_LOG_NEW_CATEGORY(msg, "All MSG categories");
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_kernel, msg, "Logging specific to MSG (kernel)");
 
-MSG_Global_t msg_global = nullptr;
+bool MSG_Global_t::debug_multiple_use = false;
+
+MSG_Global_t* msg_global = nullptr;
 simgrid::xbt::Extension<simgrid::s4u::Actor, simgrid::msg::ActorUserData> simgrid::msg::ActorUserData::EXTENSION_ID;
 
 static void MSG_exit();
@@ -31,17 +33,15 @@ void MSG_init_nocheck(int *argc, char **argv) {
   TRACE_global_init();
 
   if (not msg_global) {
-
-    msg_global = new s_MSG_Global_t();
-    if (not simgrid::msg::ActorUserData::EXTENSION_ID.valid())
-      simgrid::msg::ActorUserData::EXTENSION_ID = simgrid::s4u::Actor::extension_create<simgrid::msg::ActorUserData>();
-
-    msg_global->debug_multiple_use = false;
-    simgrid::config::bind_flag(msg_global->debug_multiple_use, "msg/debug-multiple-use",
+    simgrid::config::bind_flag(MSG_Global_t::debug_multiple_use, "msg/debug-multiple-use",
                                "Print backtraces of both processes when there is a conflict of multiple use of a task");
 
     SIMIX_global_init(argc, argv);
 
+    msg_global = new MSG_Global_t();
+    if (not simgrid::msg::ActorUserData::EXTENSION_ID.valid())
+      simgrid::msg::ActorUserData::EXTENSION_ID = simgrid::s4u::Actor::extension_create<simgrid::msg::ActorUserData>();
+
     msg_global->sent_msg = 0;
     msg_global->task_copy_callback = nullptr;
     msg_global->process_data_cleanup = nullptr;
index db817a6..13f17f4 100644 (file)
@@ -115,15 +115,14 @@ public:
 } // namespace simgrid
 
 /************************** Global variables ********************************/
-struct s_MSG_Global_t {
-  bool debug_multiple_use;           /* whether we want an error message when reusing the same Task for 2 things */
+struct MSG_Global_t {
+  static bool debug_multiple_use;    /* whether we want an error message when reusing the same Task for 2 things */
   std::atomic_int_fast32_t sent_msg; /* Total amount of messages sent during the simulation */
   void (*task_copy_callback)(msg_task_t task, msg_process_t src, msg_process_t dst);
   void_f_pvoid_t process_data_cleanup;
 };
-typedef s_MSG_Global_t* MSG_Global_t;
 
-XBT_PUBLIC_DATA MSG_Global_t msg_global;
+XBT_PUBLIC_DATA MSG_Global_t* msg_global;
 
 /*************************************************************/
 XBT_PRIVATE void MSG_comm_copy_data_from_SIMIX(simgrid::kernel::activity::CommImpl* comm, void* buff, size_t buff_size);