Skip to content

Commit d0a4198

Browse files
MarcoFalkeknst
authored andcommitted
Merge bitcoin#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
1 parent 55114a6 commit d0a4198

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

doc/developer-notes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,7 @@ class ChainstateManager
932932
{
933933
public:
934934
...
935-
bool ProcessNewBlock(...) EXCLUSIVE_LOCKS_REQUIRED(!::cs_main);
935+
bool ProcessNewBlock(...) LOCKS_EXCLUDED(::cs_main);
936936
...
937937
}
938938

src/index/base.h

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

123123
void Interrupt();
124124

src/net_processing.cpp

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

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

949949
/** Process a new block. Perform any post-processing housekeeping */
950950
void ProcessBlock(CNode& from, const std::shared_ptr<const CBlock>& pblock, bool force_processing);

src/sync.h

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

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

src/txorphanage.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class TxOrphanage {
4141
void EraseForPeer(NodeId peer) EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans);
4242

4343
/** Erase all orphans included in or invalidated by a new block */
44-
void EraseForBlock(const CBlock& block) EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans);
44+
void EraseForBlock(const CBlock& block) LOCKS_EXCLUDED(::g_cs_orphans);
4545

4646
/** Limit the orphanage to the given maximum */
4747
unsigned int LimitOrphans(unsigned int max_orphans_size) EXCLUSIVE_LOCKS_REQUIRED(g_cs_orphans);

src/wallet/wallet.h

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

14071407
/** set a single wallet flag */
14081408
void SetWalletFlag(uint64_t flags);

0 commit comments

Comments
 (0)