From f68baa6d22726a57448dec5b3c364b958eeeed1b Mon Sep 17 00:00:00 2001 From: peilixia Date: Wed, 16 Nov 2022 08:39:08 +0000 Subject: [PATCH] synchronize code Signed-off-by: peilixia --- base/include/singleton.h | 2 +- base/include/thread_pool.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/base/include/singleton.h b/base/include/singleton.h index b831f90..8a1320b 100644 --- a/base/include/singleton.h +++ b/base/include/singleton.h @@ -68,7 +68,7 @@ std::shared_ptr DelayedSingleton::GetInstance() if (instance_ == nullptr) { std::lock_guard lock(mutex_); if (instance_ == nullptr) { - std::shared_ptr temp(new T); + std::shared_ptr temp(new (std::nothrow) T); instance_ = temp; } } diff --git a/base/include/thread_pool.h b/base/include/thread_pool.h index 06bac4e..66c7907 100644 --- a/base/include/thread_pool.h +++ b/base/include/thread_pool.h @@ -37,7 +37,7 @@ public: // is restricted to 16 characters, including the terminating null byte ('\0'). // Please pay attention to the length of name(args here). explicit ThreadPool(const std::string &name = std::string()); - ~ThreadPool () override; + ~ThreadPool() override; uint32_t Start(int threadsNum); void Stop(); -- Gitee