From 7534916059d6cb27878c32fa9f8ff5a10562dcdc Mon Sep 17 00:00:00 2001 From: zhoufeng Date: Sat, 19 Dec 2020 18:58:17 +0800 Subject: [PATCH] call closeTsd when cxx lib exit Signed-off-by: zhoufeng --- mindspore/ccsrc/cxx_api/graph/ms/ms_graph_impl.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mindspore/ccsrc/cxx_api/graph/ms/ms_graph_impl.cc b/mindspore/ccsrc/cxx_api/graph/ms/ms_graph_impl.cc index 77d6a164c5..1c3116502c 100644 --- a/mindspore/ccsrc/cxx_api/graph/ms/ms_graph_impl.cc +++ b/mindspore/ccsrc/cxx_api/graph/ms/ms_graph_impl.cc @@ -117,6 +117,16 @@ Status MsGraphImpl::FinalizeEnv() { session::ExecutorManager::Instance().Clear(); device::KernelRuntimeManager::Instance().ClearRuntimeResource(); + auto ms_context = MsContext::GetInstance(); + if (ms_context == nullptr) { + MS_LOG(ERROR) << "Get Context failed!"; + return FAILED; + } + if (!context::CloseTsd(ms_context)) { + MS_LOG(ERROR) << "CloseTsd failed!"; + return FAILED; + } + init_flag_ = false; MS_LOG(INFO) << "End finalize env"; return SUCCESS;