From 9cb77566c305049f3208b711414880442fc7ac42 Mon Sep 17 00:00:00 2001 From: CryptoManiac Date: Thu, 17 Jul 2014 01:27:31 +0400 Subject: [PATCH] Turn the signature cache lock into a shared mutex --- src/script.cpp | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/script.cpp b/src/script.cpp index 8a66750..4d3586a 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -1082,13 +1082,13 @@ private: // sigdata_type is (signature hash, signature, public key): typedef boost::tuple, CPubKey > sigdata_type; std::set< sigdata_type> setValid; - CCriticalSection cs_sigcache; + boost::shared_mutex cs_sigcache; public: bool Get(const uint256 &hash, const std::vector& vchSig, const CPubKey& pubKey) { - LOCK(cs_sigcache); + boost::shared_lock lock(cs_sigcache); sigdata_type k(hash, vchSig, pubKey); std::set::iterator mi = setValid.find(k); @@ -1106,7 +1106,7 @@ public: int64 nMaxCacheSize = GetArg("-maxsigcachesize", 50000); if (nMaxCacheSize <= 0) return; - LOCK(cs_sigcache); + boost::shared_lock lock(cs_sigcache); while (static_cast(setValid.size()) > nMaxCacheSize) { -- 1.7.1