Skip to content

Commit 9ac8f6d

Browse files
author
MarcoFalke
committed
Merge #21598: refactor: Remove negative lock annotations from globals
fa5eabe 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 fa5eabe ajtowns: ACK fa5eabe hebasto: ACK fa5eabe vasild: ACK fa5eabe Tree-SHA512: 06f8a200304f81533010efcc42d9f59b8c4d0ae355920c0a28efb6fa161a3e3e68f2dfffb0c009afd9c2501e6a293c6e5a419a64d718f1f4e79668ab2ab1fcdc
2 parents 328aaac + fa5eabe commit 9ac8f6d

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

doc/developer-notes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ class ChainstateManager
812812
{
813813
public:
814814
...
815-
bool ProcessNewBlock(...) EXCLUSIVE_LOCKS_REQUIRED(!::cs_main);
815+
bool ProcessNewBlock(...) LOCKS_EXCLUDED(::cs_main);
816816
...
817817
}
818818

src/index/base.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class BaseIndex : public CValidationInterface
109109
/// sync once and only needs to process blocks in the ValidationInterface
110110
/// queue. If the index is catching up from far behind, this method does
111111
/// not block and immediately returns false.
112-
bool BlockUntilSyncedToCurrentChain() const;
112+
bool BlockUntilSyncedToCurrentChain() const LOCKS_EXCLUDED(::cs_main);
113113

114114
void Interrupt();
115115

src/net_processing.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ class PeerManagerImpl final : public PeerManager
448448
/** Determine whether or not a peer can request a transaction, and return it (or nullptr if not found or not allowed). */
449449
CTransactionRef FindTxForGetData(const CNode& peer, const GenTxid& gtxid, const std::chrono::seconds mempool_req, const std::chrono::seconds now) LOCKS_EXCLUDED(cs_main);
450450

451-
void ProcessGetData(CNode& pfrom, Peer& peer, const std::atomic<bool>& interruptMsgProc) EXCLUSIVE_LOCKS_REQUIRED(!cs_main, peer.m_getdata_requests_mutex);
451+
void ProcessGetData(CNode& pfrom, Peer& peer, const std::atomic<bool>& interruptMsgProc) EXCLUSIVE_LOCKS_REQUIRED(peer.m_getdata_requests_mutex) LOCKS_EXCLUDED(::cs_main);
452452

453453
/** Relay map (txid or wtxid -> CTransactionRef) */
454454
typedef std::map<uint256, CTransactionRef> MapRelay;

src/sync.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ std::string LocksHeld();
5656
template <typename MutexType>
5757
void AssertLockHeldInternal(const char* pszName, const char* pszFile, int nLine, MutexType* cs) EXCLUSIVE_LOCKS_REQUIRED(cs);
5858
template <typename MutexType>
59-
void AssertLockNotHeldInternal(const char* pszName, const char* pszFile, int nLine, MutexType* cs) EXCLUSIVE_LOCKS_REQUIRED(!cs);
59+
void AssertLockNotHeldInternal(const char* pszName, const char* pszFile, int nLine, MutexType* cs) LOCKS_EXCLUDED(cs);
6060
void DeleteLock(void* cs);
6161
bool LockStackEmpty();
6262

@@ -74,7 +74,7 @@ inline void CheckLastCritical(void* cs, std::string& lockname, const char* guard
7474
template <typename MutexType>
7575
inline void AssertLockHeldInternal(const char* pszName, const char* pszFile, int nLine, MutexType* cs) EXCLUSIVE_LOCKS_REQUIRED(cs) {}
7676
template <typename MutexType>
77-
void AssertLockNotHeldInternal(const char* pszName, const char* pszFile, int nLine, MutexType* cs) EXCLUSIVE_LOCKS_REQUIRED(!cs) {}
77+
void AssertLockNotHeldInternal(const char* pszName, const char* pszFile, int nLine, MutexType* cs) LOCKS_EXCLUDED(cs) {}
7878
inline void DeleteLock(void* cs) {}
7979
inline bool LockStackEmpty() { return true; }
8080
#endif

src/txorphanage.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class TxOrphanage {
2424
bool AddTx(const CTransactionRef& tx, NodeId peer) EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans);
2525

2626
/** Check if we already have an orphan transaction (by txid or wtxid) */
27-
bool HaveTx(const GenTxid& gtxid) const EXCLUSIVE_LOCKS_REQUIRED(!g_cs_orphans);
27+
bool HaveTx(const GenTxid& gtxid) const LOCKS_EXCLUDED(::g_cs_orphans);
2828

2929
/** Get an orphan transaction and its orginating peer
3030
* (Transaction ref will be nullptr if not found)
@@ -38,7 +38,7 @@ class TxOrphanage {
3838
void EraseForPeer(NodeId peer) EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans);
3939

4040
/** Erase all orphans included in or invalidated by a new block */
41-
void EraseForBlock(const CBlock& block) EXCLUSIVE_LOCKS_REQUIRED(!g_cs_orphans);
41+
void EraseForBlock(const CBlock& block) LOCKS_EXCLUDED(::g_cs_orphans);
4242

4343
/** Limit the orphanage to the given maximum */
4444
unsigned int LimitOrphans(unsigned int max_orphans) EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans);

src/wallet/wallet.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1181,7 +1181,7 @@ class CWallet final : public WalletStorage, public interfaces::Chain::Notificati
11811181
* Obviously holding cs_main/cs_wallet when going into this call may cause
11821182
* deadlock
11831183
*/
1184-
void BlockUntilSyncedToCurrentChain() const EXCLUSIVE_LOCKS_REQUIRED(!::cs_main, !cs_wallet);
1184+
void BlockUntilSyncedToCurrentChain() const LOCKS_EXCLUDED(::cs_main) EXCLUSIVE_LOCKS_REQUIRED(!cs_wallet);
11851185

11861186
/** set a single wallet flag */
11871187
void SetWalletFlag(uint64_t flags);

0 commit comments

Comments
 (0)