From 2685dbb427cbe90685e23c1000d8b6670bb91750 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Thu, 8 Aug 2019 18:32:13 +0200 Subject: [PATCH 1/1] namespacify a global function of SIMIX --- src/kernel/actor/ActorImpl.cpp | 19 +++++++++---------- src/kernel/actor/ActorImpl.hpp | 1 + src/kernel/context/Context.hpp | 2 -- src/mc/mc_global.cpp | 2 +- src/mc/mc_record.cpp | 2 +- src/mc/mc_smx.cpp | 3 +-- 6 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/kernel/actor/ActorImpl.cpp b/src/kernel/actor/ActorImpl.cpp index c8640b4762..c943038964 100644 --- a/src/kernel/actor/ActorImpl.cpp +++ b/src/kernel/actor/ActorImpl.cpp @@ -22,8 +22,6 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_process, simix, "Logging specific to SIMIX (process)"); -static unsigned long simix_process_maxpid = 0; - /** * @brief Returns the current agent. * @@ -53,9 +51,15 @@ namespace simgrid { namespace kernel { namespace actor { +static unsigned long maxpid = 0; +int get_maxpid() +{ + return maxpid; +} + ActorImpl::ActorImpl(const simgrid::xbt::string& name, s4u::Host* host) : host_(host), name_(name), piface_(this) { - pid_ = simix_process_maxpid++; + pid_ = maxpid++; simcall.issuer = this; } @@ -524,14 +528,14 @@ void create_maestro(const std::function& code) } // namespace kernel } // namespace simgrid -void SIMIX_process_detach() +void SIMIX_process_detach() // deprecated v3.25 { simgrid::kernel::actor::ActorImpl::detach(); } smx_actor_t SIMIX_process_attach(const char* name, void* data, const char* hostname, std::unordered_map* properties, - smx_actor_t /*parent_process*/) + smx_actor_t /*parent_process*/) // deprecated 3.25 { return simgrid::kernel::actor::ActorImpl::attach(name, data, sg_host_by_name(hostname), properties).get(); } @@ -550,11 +554,6 @@ void simcall_HANDLER_process_suspend(smx_simcall_t simcall, smx_actor_t actor) /* If we are suspending ourselves, then just do not finish the simcall now */ } -int SIMIX_process_get_maxpid() -{ - return simix_process_maxpid; -} - int SIMIX_process_count() { return simix_global->process_list.size(); diff --git a/src/kernel/actor/ActorImpl.hpp b/src/kernel/actor/ActorImpl.hpp index cc97cb3184..acf8f246af 100644 --- a/src/kernel/actor/ActorImpl.hpp +++ b/src/kernel/actor/ActorImpl.hpp @@ -179,6 +179,7 @@ typedef boost::intrusive::list& code); +XBT_PUBLIC int get_maxpid(); } // namespace actor } // namespace kernel } // namespace simgrid diff --git a/src/kernel/context/Context.hpp b/src/kernel/context/Context.hpp index 0d93213c93..b2fadf009a 100644 --- a/src/kernel/context/Context.hpp +++ b/src/kernel/context/Context.hpp @@ -109,8 +109,6 @@ XBT_PRIVATE void SIMIX_context_mod_exit(); XBT_PUBLIC_DATA unsigned char sigsegv_stack[SIGSTKSZ]; #endif -XBT_PUBLIC int SIMIX_process_get_maxpid(); - XBT_PRIVATE simgrid::simix::ActorCodeFactory& SIMIX_get_actor_code_factory(const std::string& name); #endif diff --git a/src/mc/mc_global.cpp b/src/mc/mc_global.cpp index 944de529aa..b63e1c1192 100644 --- a/src/mc/mc_global.cpp +++ b/src/mc/mc_global.cpp @@ -77,7 +77,7 @@ void MC_init_dot_output() void MC_run() { - simgrid::mc::processes_time.resize(SIMIX_process_get_maxpid()); + simgrid::mc::processes_time.resize(simgrid::kernel::actor::get_maxpid()); MC_ignore_heap(simgrid::mc::processes_time.data(), simgrid::mc::processes_time.size() * sizeof(simgrid::mc::processes_time[0])); simgrid::mc::Client::get()->main_loop(); diff --git a/src/mc/mc_record.cpp b/src/mc/mc_record.cpp index 50d659ca40..685c491571 100644 --- a/src/mc/mc_record.cpp +++ b/src/mc/mc_record.cpp @@ -48,7 +48,7 @@ void replay(RecordTrace const& trace) void replay(const std::string& path_string) { - simgrid::mc::processes_time.resize(SIMIX_process_get_maxpid()); + simgrid::mc::processes_time.resize(simgrid::kernel::actor::get_maxpid()); simgrid::mc::RecordTrace trace = simgrid::mc::parseRecordTrace(path_string.c_str()); simgrid::mc::replay(trace); simgrid::mc::processes_time.clear(); diff --git a/src/mc/mc_smx.cpp b/src/mc/mc_smx.cpp index 2830defe05..8421cb7d04 100644 --- a/src/mc/mc_smx.cpp +++ b/src/mc/mc_smx.cpp @@ -148,7 +148,6 @@ const char* MC_smx_actor_get_name(smx_actor_t actor) unsigned long MC_smx_get_maxpid() { unsigned long maxpid; - mc_model_checker->process().read_variable("simix_process_maxpid", - &maxpid, sizeof(maxpid)); + mc_model_checker->process().read_variable("simgrid::kernel::actor::maxpid", &maxpid, sizeof(maxpid)); return maxpid; } -- 2.20.1