mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 22:18:54 +01:00
Merge bitcoin/bitcoin#24931: Strengthen thread safety assertions
ce893c0497doc: Update developer notes (Anthony Towns)d2852917eesync.h: Imply negative assertions when calling LOCK (Anthony Towns)bba87c0553scripted-diff: Convert global Mutexes to GlobalMutexes (Anthony Towns)a559509a0bsync.h: Add GlobalMutex type (Anthony Towns)be6aa72f9fqt/clientmodel: thread safety annotation for m_cached_tip_mutex (Anthony Towns)f24bd45b37net_processing: thread safety annotation for m_tx_relay_mutex (Anthony Towns) Pull request description: This changes `LOCK(mutex)` for non-global, non-recursive mutexes to be annotated with the negative capability for the mutex it refers to, to prevent . clang applies negative capabilities recursively, so this helps avoid forgetting to annotate functions. This can't reasonably be used for globals, because clang would require every function to be annotated with `EXCLUSIVE_LOCKS_REQUIRED(!g_mutex)` for each global mutex; so this introduces a trivial `GlobalMutex` subclass of `Mutex`, and reduces the annotations for both `GlobalMutex` to `LOCKS_EXCLUDED` which only catches trivial errors (eg (`LOCK(x); LOCK(x);`). ACKs for top commit: MarcoFalke: review ACKce893c0497🐦 hebasto: ACKce893c0497Tree-SHA512: 5c35e8c7677ce3d994a7e3774f4344adad496223a51b3a1d1d3b5f20684b2e1d5cff688eb3fbc8d33e1b9940dfa76e515f9434e21de6f3ce3c935e29a319f529
This commit is contained in:
@@ -113,7 +113,7 @@ enum class SynchronizationState {
|
||||
};
|
||||
|
||||
extern RecursiveMutex cs_main;
|
||||
extern Mutex g_best_block_mutex;
|
||||
extern GlobalMutex g_best_block_mutex;
|
||||
extern std::condition_variable g_best_block_cv;
|
||||
/** Used to notify getblocktemplate RPC of new tips. */
|
||||
extern uint256 g_best_block;
|
||||
|
||||
Reference in New Issue
Block a user