Fix glog thread-safe bug for standalone mode (#27703)

Signed-off-by: luzhang <luzhang@zilliz.com>
Co-authored-by: luzhang <luzhang@zilliz.com>
pull/27713/head
zhagnlu 2023-10-14 12:10:05 +08:00 committed by GitHub
parent 75343b2cb4
commit c5ea31316d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 3 deletions

View File

@ -15,6 +15,9 @@
#include "segcore/segcore_init_c.h"
namespace milvus::segcore {
std::once_flag close_glog_once;
extern "C" void
SegcoreInit(const char* conf_file) {
milvus::config::KnowhereInitImpl(conf_file);
@ -72,9 +75,11 @@ SegcoreSetSimdType(const char* value) {
extern "C" void
SegcoreCloseGlog() {
if (google::IsGoogleLoggingInitialized()) {
google::ShutdownGoogleLogging();
}
std::call_once(close_glog_once, [&]() {
if (google::IsGoogleLoggingInitialized()) {
google::ShutdownGoogleLogging();
}
});
}
extern "C" int32_t