diff --git a/src/libxrpl/beast/insight/Groups.cpp b/src/libxrpl/beast/insight/Groups.cpp index 6a60c75aa2..fbdf8f3527 100644 --- a/src/libxrpl/beast/insight/Groups.cpp +++ b/src/libxrpl/beast/insight/Groups.cpp @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -87,6 +88,7 @@ public: Collector::ptr collector; Items items; + mutable std::mutex groupMutex; explicit GroupsImp(Collector::ptr collector) : collector(std::move(collector)) { @@ -97,6 +99,7 @@ public: Group::ptr const& get(std::string const& name) override { + std::scoped_lock const _{groupMutex}; std::pair const result(items.emplace(name, Group::ptr())); Group::ptr& group(result.first->second); if (result.second)