未验证 提交 c670848e 编写于 作者: H huzhiqiang 提交者: GitHub

[Framework] Fix the issue that `CreatePaddlePredictor` method is not safe for...

 [Framework] Fix the issue that `CreatePaddlePredictor` method is not safe for multi-thread condition #4014
上级 a086f2e2
...@@ -177,6 +177,8 @@ namespace lite_api { ...@@ -177,6 +177,8 @@ namespace lite_api {
template <> template <>
std::shared_ptr<PaddlePredictor> CreatePaddlePredictor( std::shared_ptr<PaddlePredictor> CreatePaddlePredictor(
const CxxConfig &config) { const CxxConfig &config) {
static std::mutex mutex_conf;
std::unique_lock<std::mutex> lck(mutex_conf);
auto x = std::make_shared<lite::CxxPaddleApiImpl>(); auto x = std::make_shared<lite::CxxPaddleApiImpl>();
x->Init(config); x->Init(config);
return x; return x;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册