未验证 提交 9087c668 编写于 作者: G gongweibao 提交者: GitHub

polish (#11363)

上级 a3408d00
...@@ -17,12 +17,11 @@ limitations under the License. */ ...@@ -17,12 +17,11 @@ limitations under the License. */
namespace paddle { namespace paddle {
namespace framework { namespace framework {
static OpInfoMap* g_op_info_map = nullptr; // C++11 removes the need for manual locking. Concurrent execution shall wait if
// a static local variable is already being initialized.
// https://stackoverflow.com/questions/11711920/how-to-implement-multithread-safe-singleton-in-c11-without-using-mutex
OpInfoMap& OpInfoMap::Instance() { OpInfoMap& OpInfoMap::Instance() {
if (g_op_info_map == nullptr) { static OpInfoMap* g_op_info_map = new OpInfoMap();
g_op_info_map = new OpInfoMap();
}
return *g_op_info_map; return *g_op_info_map;
} }
} // namespace framework } // namespace framework
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册