mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-09 10:43:19 -05:00
refactor: replace Boost shared_mutex with std shared_mutex in sigcache
Co-authored-by: MarcoFalke falke.marco@gmail.com Co-authored-by: sinetek pitwuu@gmail.com
This commit is contained in:
parent
8e55981ef8
commit
7097add83c
2 changed files with 7 additions and 7 deletions
|
@ -12,8 +12,10 @@
|
||||||
|
|
||||||
#include <cuckoocache.h>
|
#include <cuckoocache.h>
|
||||||
|
|
||||||
#include <boost/thread/lock_types.hpp>
|
#include <algorithm>
|
||||||
#include <boost/thread/shared_mutex.hpp>
|
#include <mutex>
|
||||||
|
#include <shared_mutex>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
/**
|
/**
|
||||||
|
@ -29,7 +31,7 @@ private:
|
||||||
CSHA256 m_salted_hasher_schnorr;
|
CSHA256 m_salted_hasher_schnorr;
|
||||||
typedef CuckooCache::cache<uint256, SignatureCacheHasher> map_type;
|
typedef CuckooCache::cache<uint256, SignatureCacheHasher> map_type;
|
||||||
map_type setValid;
|
map_type setValid;
|
||||||
boost::shared_mutex cs_sigcache;
|
std::shared_mutex cs_sigcache;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CSignatureCache()
|
CSignatureCache()
|
||||||
|
@ -64,13 +66,13 @@ public:
|
||||||
bool
|
bool
|
||||||
Get(const uint256& entry, const bool erase)
|
Get(const uint256& entry, const bool erase)
|
||||||
{
|
{
|
||||||
boost::shared_lock<boost::shared_mutex> lock(cs_sigcache);
|
std::shared_lock<std::shared_mutex> lock(cs_sigcache);
|
||||||
return setValid.contains(entry, erase);
|
return setValid.contains(entry, erase);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Set(const uint256& entry)
|
void Set(const uint256& entry)
|
||||||
{
|
{
|
||||||
boost::unique_lock<boost::shared_mutex> lock(cs_sigcache);
|
std::unique_lock<std::shared_mutex> lock(cs_sigcache);
|
||||||
setValid.insert(entry);
|
setValid.insert(entry);
|
||||||
}
|
}
|
||||||
uint32_t setup_bytes(size_t n)
|
uint32_t setup_bytes(size_t n)
|
||||||
|
|
|
@ -67,8 +67,6 @@ EXPECTED_BOOST_INCLUDES=(
|
||||||
boost/signals2/optional_last_value.hpp
|
boost/signals2/optional_last_value.hpp
|
||||||
boost/signals2/signal.hpp
|
boost/signals2/signal.hpp
|
||||||
boost/test/unit_test.hpp
|
boost/test/unit_test.hpp
|
||||||
boost/thread/lock_types.hpp
|
|
||||||
boost/thread/shared_mutex.hpp
|
|
||||||
)
|
)
|
||||||
|
|
||||||
for BOOST_INCLUDE in $(git grep '^#include <boost/' -- "*.cpp" "*.h" | cut -f2 -d: | cut -f2 -d'<' | cut -f1 -d'>' | sort -u); do
|
for BOOST_INCLUDE in $(git grep '^#include <boost/' -- "*.cpp" "*.h" | cut -f2 -d: | cut -f2 -d'<' | cut -f1 -d'>' | sort -u); do
|
||||||
|
|
Loading…
Add table
Reference in a new issue