diff --git a/internal/core/src/storage/ThreadPools.cpp b/internal/core/src/storage/ThreadPools.cpp index e6ecff3ea2..f0b6513726 100644 --- a/internal/core/src/storage/ThreadPools.cpp +++ b/internal/core/src/storage/ThreadPools.cpp @@ -14,12 +14,12 @@ // #include "ThreadPools.h" +#include namespace milvus { std::map> ThreadPools::thread_pool_map; -std::map ThreadPools::name_map; std::shared_mutex ThreadPools::mutex_; void @@ -50,7 +50,7 @@ ThreadPools::GetThreadPool(milvus::ThreadPoolPriority priority) { coefficient = LOW_PRIORITY_THREAD_CORE_COEFFICIENT; break; } - std::string name = name_map[priority]; + std::string name = name_map()[priority]; auto result = thread_pool_map.emplace( priority, std::make_unique(coefficient, name)); return *(result.first->second); diff --git a/internal/core/src/storage/ThreadPools.h b/internal/core/src/storage/ThreadPools.h index 4400a02097..8c6dd6e05f 100644 --- a/internal/core/src/storage/ThreadPools.h +++ b/internal/core/src/storage/ThreadPools.h @@ -42,15 +42,21 @@ class ThreadPools { private: ThreadPools() { - name_map[HIGH] = "high_priority_thread_pool"; - name_map[MIDDLE] = "middle_priority_thread_pool"; - name_map[LOW] = "low_priority_thread_pool"; } void ShutDown(); + + static std::map + name_map() { + static std::map name_map = { + {HIGH, "HIGH_SEGC_POOL"}, + {MIDDLE, "MIDD_SEGC_POOL"}, + {LOW, "LOW_SEGC_POOL"}}; + return name_map; + } + static std::map> thread_pool_map; - static std::map name_map; static std::shared_mutex mutex_; };