aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-04-06 07:54:07 +0200
committerMarcoFalke <falke.marco@gmail.com>2021-04-06 07:54:12 +0200
commit9ac8f6d7ddc4c949d84de5584baa813144c7fb26 (patch)
tree7b6362d08628ea6f2c496f1937070fedfa0ed9d7 /src
parent328aaac80d6fa28430a567230ae317362d64f897 (diff)
parentfa5eabe72117f6e3704858e8d5b2c57a120258ed (diff)
downloadbitcoin-9ac8f6d7ddc4c949d84de5584baa813144c7fb26.tar.xz
Merge #21598: refactor: Remove negative lock annotations from globals
fa5eabe72117f6e3704858e8d5b2c57a120258ed refactor: Remove negative lock annotations from globals (MarcoFalke) Pull request description: They only make sense for mutexes that are private members. Until cs_main is a private member the negative annotations should be replaced by excluded annotations, which are optional. ACKs for top commit: sipa: utACK fa5eabe72117f6e3704858e8d5b2c57a120258ed ajtowns: ACK fa5eabe72117f6e3704858e8d5b2c57a120258ed hebasto: ACK fa5eabe72117f6e3704858e8d5b2c57a120258ed vasild: ACK fa5eabe72117f6e3704858e8d5b2c57a120258ed Tree-SHA512: 06f8a200304f81533010efcc42d9f59b8c4d0ae355920c0a28efb6fa161a3e3e68f2dfffb0c009afd9c2501e6a293c6e5a419a64d718f1f4e79668ab2ab1fcdc
Diffstat (limited to 'src')
-rw-r--r--src/index/base.h2
-rw-r--r--src/net_processing.cpp2
-rw-r--r--src/sync.h4
-rw-r--r--src/txorphanage.h4
-rw-r--r--src/wallet/wallet.h2
5 files changed, 7 insertions, 7 deletions
diff --git a/src/index/base.h b/src/index/base.h
index 8559e3cb64..ac3c429a5a 100644
--- a/src/index/base.h
+++ b/src/index/base.h
@@ -109,7 +109,7 @@ public:
/// sync once and only needs to process blocks in the ValidationInterface
/// queue. If the index is catching up from far behind, this method does
/// not block and immediately returns false.
- bool BlockUntilSyncedToCurrentChain() const;
+ bool BlockUntilSyncedToCurrentChain() const LOCKS_EXCLUDED(::cs_main);
void Interrupt();
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index 4108de2c8a..d98d47fd2a 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -448,7 +448,7 @@ private:
/** Determine whether or not a peer can request a transaction, and return it (or nullptr if not found or not allowed). */
CTransactionRef FindTxForGetData(const CNode& peer, const GenTxid& gtxid, const std::chrono::seconds mempool_req, const std::chrono::seconds now) LOCKS_EXCLUDED(cs_main);
- void ProcessGetData(CNode& pfrom, Peer& peer, const std::atomic<bool>& interruptMsgProc) EXCLUSIVE_LOCKS_REQUIRED(!cs_main, peer.m_getdata_requests_mutex);
+ void ProcessGetData(CNode& pfrom, Peer& peer, const std::atomic<bool>& interruptMsgProc) EXCLUSIVE_LOCKS_REQUIRED(peer.m_getdata_requests_mutex) LOCKS_EXCLUDED(::cs_main);
/** Relay map (txid or wtxid -> CTransactionRef) */
typedef std::map<uint256, CTransactionRef> MapRelay;
diff --git a/src/sync.h b/src/sync.h
index 53213c2089..146c228592 100644
--- a/src/sync.h
+++ b/src/sync.h
@@ -56,7 +56,7 @@ std::string LocksHeld();
template <typename MutexType>
void AssertLockHeldInternal(const char* pszName, const char* pszFile, int nLine, MutexType* cs) EXCLUSIVE_LOCKS_REQUIRED(cs);
template <typename MutexType>
-void AssertLockNotHeldInternal(const char* pszName, const char* pszFile, int nLine, MutexType* cs) EXCLUSIVE_LOCKS_REQUIRED(!cs);
+void AssertLockNotHeldInternal(const char* pszName, const char* pszFile, int nLine, MutexType* cs) LOCKS_EXCLUDED(cs);
void DeleteLock(void* cs);
bool LockStackEmpty();
@@ -74,7 +74,7 @@ inline void CheckLastCritical(void* cs, std::string& lockname, const char* guard
template <typename MutexType>
inline void AssertLockHeldInternal(const char* pszName, const char* pszFile, int nLine, MutexType* cs) EXCLUSIVE_LOCKS_REQUIRED(cs) {}
template <typename MutexType>
-void AssertLockNotHeldInternal(const char* pszName, const char* pszFile, int nLine, MutexType* cs) EXCLUSIVE_LOCKS_REQUIRED(!cs) {}
+void AssertLockNotHeldInternal(const char* pszName, const char* pszFile, int nLine, MutexType* cs) LOCKS_EXCLUDED(cs) {}
inline void DeleteLock(void* cs) {}
inline bool LockStackEmpty() { return true; }
#endif
diff --git a/src/txorphanage.h b/src/txorphanage.h
index df55cdb3be..dc9fa87dbb 100644
--- a/src/txorphanage.h
+++ b/src/txorphanage.h
@@ -24,7 +24,7 @@ public:
bool AddTx(const CTransactionRef& tx, NodeId peer) EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans);
/** Check if we already have an orphan transaction (by txid or wtxid) */
- bool HaveTx(const GenTxid& gtxid) const EXCLUSIVE_LOCKS_REQUIRED(!g_cs_orphans);
+ bool HaveTx(const GenTxid& gtxid) const LOCKS_EXCLUDED(::g_cs_orphans);
/** Get an orphan transaction and its orginating peer
* (Transaction ref will be nullptr if not found)
@@ -38,7 +38,7 @@ public:
void EraseForPeer(NodeId peer) EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans);
/** Erase all orphans included in or invalidated by a new block */
- void EraseForBlock(const CBlock& block) EXCLUSIVE_LOCKS_REQUIRED(!g_cs_orphans);
+ void EraseForBlock(const CBlock& block) LOCKS_EXCLUDED(::g_cs_orphans);
/** Limit the orphanage to the given maximum */
unsigned int LimitOrphans(unsigned int max_orphans) EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans);
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index 6031d36b97..192fd60dc2 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -1181,7 +1181,7 @@ public:
* Obviously holding cs_main/cs_wallet when going into this call may cause
* deadlock
*/
- void BlockUntilSyncedToCurrentChain() const EXCLUSIVE_LOCKS_REQUIRED(!::cs_main, !cs_wallet);
+ void BlockUntilSyncedToCurrentChain() const LOCKS_EXCLUDED(::cs_main) EXCLUSIVE_LOCKS_REQUIRED(!cs_wallet);
/** set a single wallet flag */
void SetWalletFlag(uint64_t flags);