提交 1cd95d8a 编写于 作者: P peizhilin

use thread local instance test=develop

上级 a6f5ceee
......@@ -23,8 +23,10 @@ template <>
std::string PythonDebugSupport::Format() const {
std::ostringstream sout;
sout << "\nPython Callstacks: \n";
for (auto& line : info) {
sout << line;
if (!info.empty()) {
for (auto &line : info) {
sout << line;
}
}
return sout.str();
}
......
......@@ -30,8 +30,8 @@ class DebugSupport {
public:
// Returns the singleton of DebugSupport.
static DebugSupport* GetInstance() {
static std::unique_ptr<DebugSupport> debugSupport_(nullptr);
static std::once_flag init_flag_;
static thread_local std::unique_ptr<DebugSupport> debugSupport_(nullptr);
static thread_local std::once_flag init_flag_;
std::call_once(init_flag_,
[&]() { debugSupport_.reset(new DebugSupport<T>()); });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册