From bc626e321fa915f1eefcb41cb2bce6d2c8435ac2 Mon Sep 17 00:00:00 2001 From: fishbell Date: Mon, 25 Dec 2023 05:22:04 -0500 Subject: [PATCH] fix rc Signed-off-by: fishbell --- src/core/include/openvino/core/layout.hpp | 5 ++++- src/core/src/layout.cpp | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/include/openvino/core/layout.hpp b/src/core/include/openvino/core/layout.hpp index abc14cb7519d50..757b01b5165ec8 100644 --- a/src/core/include/openvino/core/layout.hpp +++ b/src/core/include/openvino/core/layout.hpp @@ -209,13 +209,16 @@ class OPENVINO_API LayoutAttribute : public ov::RuntimeAttribute { LayoutAttribute() = default; - explicit LayoutAttribute(const Layout& value) : value(value) {} + explicit LayoutAttribute(const Layout& value) : value(value), m_mutex(std::make_shared()) {} bool visit_attributes(AttributeVisitor& visitor) override; std::string to_string() const override; Layout value; + +private: + std::shared_ptr m_mutex; }; } // namespace ov diff --git a/src/core/src/layout.cpp b/src/core/src/layout.cpp index eb90ec191d79e1..cd46c94b648dbc 100644 --- a/src/core/src/layout.cpp +++ b/src/core/src/layout.cpp @@ -638,6 +638,7 @@ void AttributeAdapter::set(const std::string& value) { } bool LayoutAttribute::visit_attributes(AttributeVisitor& visitor) { + std::lock_guard lock{*m_mutex.get()}; std::string layout_str = value.to_string(); visitor.on_attribute("layout", layout_str); value = Layout(layout_str);