You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2019/10/09 14:18:47 UTC

[GitHub] [incubator-doris] imay commented on a change in pull request #1942: Fixed: add mutex for cpu_info init()

imay commented on a change in pull request #1942: Fixed: add mutex for cpu_info init()
URL: https://github.com/apache/incubator-doris/pull/1942#discussion_r333038878
 
 

 ##########
 File path: be/src/util/cpu_info.cpp
 ##########
 @@ -81,6 +81,7 @@ int CpuInfo::max_num_numa_nodes_;
 unique_ptr<int[]> CpuInfo::core_to_numa_node_;
 vector<vector<int>> CpuInfo::numa_node_to_cores_;
 vector<int> CpuInfo::numa_node_core_idx_;
+pthread_mutex_t CpuInfo::init_mutex_;
 
 Review comment:
   1. we don't need this lock, because CpuInfo is only initialized in main function.
   2. even if we need a lock, std::mutex is preferred.
   3. you don't call pthread_mutex_init() to initialize this variable, it will lead process crash.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org