This is an automated email from the ASF dual-hosted git repository. jamesge pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-brpc.git
The following commit(s) were added to refs/heads/master by this push: new ed9d8d2 Made two global variables static ed9d8d2 is described below commit ed9d8d268726d3d35d633d752bad6a3d131b4f51 Author: jamesge <jge...@gmail.com> AuthorDate: Fri Nov 15 03:15:23 2019 -0800 Made two global variables static --- src/bvar/detail/sampler.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/bvar/detail/sampler.cpp b/src/bvar/detail/sampler.cpp index 551b716..a5645d3 100644 --- a/src/bvar/detail/sampler.cpp +++ b/src/bvar/detail/sampler.cpp @@ -117,8 +117,8 @@ private: pthread_t _tid; }; -PassiveStatus<double>* g_cumulated_time_bvar = NULL; -bvar::PerSecond<bvar::PassiveStatus<double> >* g_sampling_thread_usage_bvar = NULL; +static PassiveStatus<double>* s_cumulated_time_bvar = NULL; +static bvar::PerSecond<bvar::PassiveStatus<double> >* s_sampling_thread_usage_bvar = NULL; void SamplerCollector::run() { #ifndef UNIT_TEST @@ -127,14 +127,14 @@ void SamplerCollector::run() { // may be adandoned at any time after forking. // * They can't created inside the constructor of SamplerCollector as well, // which results in deadlock. - if (g_cumulated_time_bvar == NULL) { - g_cumulated_time_bvar = + if (s_cumulated_time_bvar == NULL) { + s_cumulated_time_bvar = new PassiveStatus<double>(get_cumulated_time, this); } - if (g_sampling_thread_usage_bvar == NULL) { - g_sampling_thread_usage_bvar = + if (s_sampling_thread_usage_bvar == NULL) { + s_sampling_thread_usage_bvar = new bvar::PerSecond<bvar::PassiveStatus<double> >( - "bvar_sampler_collector_usage", g_cumulated_time_bvar, 10); + "bvar_sampler_collector_usage", s_cumulated_time_bvar, 10); } #endif --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org For additional commands, e-mail: dev-h...@brpc.apache.org