mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 22:50:59 +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:
@@ -114,7 +114,7 @@ static const uint64_t RANDOMIZER_ID_ADDRCACHE = 0x1cf2e4ddd306dda9ULL; // SHA256
|
||||
//
|
||||
bool fDiscover = true;
|
||||
bool fListen = true;
|
||||
Mutex g_maplocalhost_mutex;
|
||||
GlobalMutex g_maplocalhost_mutex;
|
||||
std::map<CNetAddr, LocalServiceInfo> mapLocalHost GUARDED_BY(g_maplocalhost_mutex);
|
||||
static bool vfLimited[NET_MAX] GUARDED_BY(g_maplocalhost_mutex) = {};
|
||||
std::string strSubVersion;
|
||||
|
||||
Reference in New Issue
Block a user