From: Arnaud Giersch Date: Mon, 25 Mar 2019 14:31:14 +0000 (+0100) Subject: Make config flag static (global), and rename s_MSG_Global_t. X-Git-Tag: v3_22~33^2~1 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/2757e5aa6f52b8ff53aec3ad5e5ca5c412fb2813 Make config flag static (global), and rename s_MSG_Global_t. --- diff --git a/src/msg/msg_global.cpp b/src/msg/msg_global.cpp index a985757e83..5b6713b18f 100644 --- a/src/msg/msg_global.cpp +++ b/src/msg/msg_global.cpp @@ -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::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(); - - 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(); + msg_global->sent_msg = 0; msg_global->task_copy_callback = nullptr; msg_global->process_data_cleanup = nullptr; diff --git a/src/msg/msg_private.hpp b/src/msg/msg_private.hpp index db817a66fb..13f17f4973 100644 --- a/src/msg/msg_private.hpp +++ b/src/msg/msg_private.hpp @@ -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);