Skip to content

Commit 7097add

Browse files
committed
refactor: replace Boost shared_mutex with std shared_mutex in sigcache
Co-authored-by: MarcoFalke [email protected] Co-authored-by: sinetek [email protected]
1 parent 8e55981 commit 7097add

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/script/sigcache.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212

1313
#include <cuckoocache.h>
1414

15-
#include <boost/thread/lock_types.hpp>
16-
#include <boost/thread/shared_mutex.hpp>
15+
#include <algorithm>
16+
#include <mutex>
17+
#include <shared_mutex>
18+
#include <vector>
1719

1820
namespace {
1921
/**
@@ -29,7 +31,7 @@ class CSignatureCache
2931
CSHA256 m_salted_hasher_schnorr;
3032
typedef CuckooCache::cache<uint256, SignatureCacheHasher> map_type;
3133
map_type setValid;
32-
boost::shared_mutex cs_sigcache;
34+
std::shared_mutex cs_sigcache;
3335

3436
public:
3537
CSignatureCache()
@@ -64,13 +66,13 @@ class CSignatureCache
6466
bool
6567
Get(const uint256& entry, const bool erase)
6668
{
67-
boost::shared_lock<boost::shared_mutex> lock(cs_sigcache);
69+
std::shared_lock<std::shared_mutex> lock(cs_sigcache);
6870
return setValid.contains(entry, erase);
6971
}
7072

7173
void Set(const uint256& entry)
7274
{
73-
boost::unique_lock<boost::shared_mutex> lock(cs_sigcache);
75+
std::unique_lock<std::shared_mutex> lock(cs_sigcache);
7476
setValid.insert(entry);
7577
}
7678
uint32_t setup_bytes(size_t n)

test/lint/lint-includes.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ EXPECTED_BOOST_INCLUDES=(
6767
boost/signals2/optional_last_value.hpp
6868
boost/signals2/signal.hpp
6969
boost/test/unit_test.hpp
70-
boost/thread/lock_types.hpp
71-
boost/thread/shared_mutex.hpp
7270
)
7371

7472
for BOOST_INCLUDE in $(git grep '^#include <boost/' -- "*.cpp" "*.h" | cut -f2 -d: | cut -f2 -d'<' | cut -f1 -d'>' | sort -u); do

0 commit comments

Comments
 (0)