From d0f836581b6997591ac744a8672650947e7f0a5f Mon Sep 17 00:00:00 2001 From: Valentin Balaschenko <13349202+vlntb@users.noreply.github.com> Date: Fri, 13 Jun 2025 14:45:27 +0100 Subject: [PATCH] remove mutex and dead references --- include/xrpl/basics/SHAMapHash.h | 1 - include/xrpl/basics/TaggedCache.h | 8 ++------ include/xrpl/basics/TaggedCache.ipp | 11 ++++------- include/xrpl/protocol/Protocol.h | 1 - 4 files changed, 6 insertions(+), 15 deletions(-) diff --git a/include/xrpl/basics/SHAMapHash.h b/include/xrpl/basics/SHAMapHash.h index 2d2dcdc3ef..1ec326409c 100644 --- a/include/xrpl/basics/SHAMapHash.h +++ b/include/xrpl/basics/SHAMapHash.h @@ -21,7 +21,6 @@ #define RIPPLE_BASICS_SHAMAP_HASH_H_INCLUDED #include -#include #include diff --git a/include/xrpl/basics/TaggedCache.h b/include/xrpl/basics/TaggedCache.h index 46e7654f02..05c493c186 100644 --- a/include/xrpl/basics/TaggedCache.h +++ b/include/xrpl/basics/TaggedCache.h @@ -297,8 +297,7 @@ private: [[maybe_unused]] clock_type::time_point const& now, typename KeyValueCacheType::map_type& partition, SweptPointersVector& stuffToSweep, - std::atomic& allRemovals, - std::lock_guard const&); + std::atomic& allRemoval); [[nodiscard]] std::thread sweepHelper( @@ -306,15 +305,12 @@ private: clock_type::time_point const& now, typename KeyOnlyCacheType::map_type& partition, SweptPointersVector&, - std::atomic& allRemovals, - std::lock_guard const&); + std::atomic& allRemovals); beast::Journal m_journal; clock_type& m_clock; Stats m_stats; - mutex_type mutable m_mutex; - // Used for logging std::string m_name; diff --git a/include/xrpl/basics/TaggedCache.ipp b/include/xrpl/basics/TaggedCache.ipp index 8803fd2681..02e7ae2203 100644 --- a/include/xrpl/basics/TaggedCache.ipp +++ b/include/xrpl/basics/TaggedCache.ipp @@ -293,7 +293,7 @@ TaggedCache< auto const start = std::chrono::steady_clock::now(); { - std::lock_guard lock(m_mutex); + // TODO: lock the cache partition if (m_target_size == 0 || (static_cast(m_cache.size()) <= m_target_size)) @@ -325,8 +325,7 @@ TaggedCache< now, m_cache.map()[p], allStuffToSweep[p], - allRemovals, - lock)); + allRemovals)); } for (std::thread& worker : workers) worker.join(); @@ -867,8 +866,7 @@ TaggedCache< [[maybe_unused]] clock_type::time_point const& now, typename KeyValueCacheType::map_type& partition, SweptPointersVector& stuffToSweep, - std::atomic& allRemovals, - std::lock_guard const&) + std::atomic& allRemovals) { return std::thread([&, this]() { int cacheRemovals = 0; @@ -956,8 +954,7 @@ TaggedCache< clock_type::time_point const& now, typename KeyOnlyCacheType::map_type& partition, SweptPointersVector&, - std::atomic& allRemovals, - std::lock_guard const&) + std::atomic& allRemovals) { return std::thread([&, this]() { int cacheRemovals = 0; diff --git a/include/xrpl/protocol/Protocol.h b/include/xrpl/protocol/Protocol.h index 898fd06fbd..bd39233cca 100644 --- a/include/xrpl/protocol/Protocol.h +++ b/include/xrpl/protocol/Protocol.h @@ -22,7 +22,6 @@ #include #include -#include #include