0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-02 09:46:52 -05:00

scripted-diff: Convert global Mutexes to GlobalMutexes

-BEGIN VERIFY SCRIPT-
sed -i -E -e '/^([a-z]+ )?Mutex [a-z]/ s/Mutex/GlobalMutex/' $(git grep -lE '^([a-z]+ )?Mutex [a-z]')
-END VERIFY SCRIPT-
This commit is contained in:
Anthony Towns 2022-04-20 17:10:13 +10:00
parent a559509a0b
commit bba87c0553
13 changed files with 15 additions and 15 deletions

View file

@ -600,7 +600,7 @@ void SetupServerArgs(ArgsManager& argsman)
} }
static bool fHaveGenesis = false; static bool fHaveGenesis = false;
static Mutex g_genesis_wait_mutex; static GlobalMutex g_genesis_wait_mutex;
static std::condition_variable g_genesis_wait_cv; static std::condition_variable g_genesis_wait_cv;
static void BlockNotifyGenesisWait(const CBlockIndex* pBlockIndex) static void BlockNotifyGenesisWait(const CBlockIndex* pBlockIndex)

View file

@ -113,7 +113,7 @@ static const uint64_t RANDOMIZER_ID_ADDRCACHE = 0x1cf2e4ddd306dda9ULL; // SHA256
// //
bool fDiscover = true; bool fDiscover = true;
bool fListen = true; bool fListen = true;
Mutex g_maplocalhost_mutex; GlobalMutex g_maplocalhost_mutex;
std::map<CNetAddr, LocalServiceInfo> mapLocalHost GUARDED_BY(g_maplocalhost_mutex); std::map<CNetAddr, LocalServiceInfo> mapLocalHost GUARDED_BY(g_maplocalhost_mutex);
static bool vfLimited[NET_MAX] GUARDED_BY(g_maplocalhost_mutex) = {}; static bool vfLimited[NET_MAX] GUARDED_BY(g_maplocalhost_mutex) = {};
std::string strSubVersion; std::string strSubVersion;

View file

@ -248,7 +248,7 @@ struct LocalServiceInfo {
uint16_t nPort; uint16_t nPort;
}; };
extern Mutex g_maplocalhost_mutex; extern GlobalMutex g_maplocalhost_mutex;
extern std::map<CNetAddr, LocalServiceInfo> mapLocalHost GUARDED_BY(g_maplocalhost_mutex); extern std::map<CNetAddr, LocalServiceInfo> mapLocalHost GUARDED_BY(g_maplocalhost_mutex);
extern const std::string NET_MESSAGE_TYPE_OTHER; extern const std::string NET_MESSAGE_TYPE_OTHER;

View file

@ -30,7 +30,7 @@
#endif #endif
// Settings // Settings
static Mutex g_proxyinfo_mutex; static GlobalMutex g_proxyinfo_mutex;
static Proxy proxyInfo[NET_MAX] GUARDED_BY(g_proxyinfo_mutex); static Proxy proxyInfo[NET_MAX] GUARDED_BY(g_proxyinfo_mutex);
static Proxy nameProxy GUARDED_BY(g_proxyinfo_mutex); static Proxy nameProxy GUARDED_BY(g_proxyinfo_mutex);
int nConnectTimeout = DEFAULT_CONNECT_TIMEOUT; int nConnectTimeout = DEFAULT_CONNECT_TIMEOUT;

View file

@ -66,7 +66,7 @@ struct CUpdatedBlock
int height; int height;
}; };
static Mutex cs_blockchange; static GlobalMutex cs_blockchange;
static std::condition_variable cond_blockchange; static std::condition_variable cond_blockchange;
static CUpdatedBlock latestblock GUARDED_BY(cs_blockchange); static CUpdatedBlock latestblock GUARDED_BY(cs_blockchange);

View file

@ -19,14 +19,14 @@
#include <mutex> #include <mutex>
#include <unordered_map> #include <unordered_map>
static Mutex g_rpc_warmup_mutex; static GlobalMutex g_rpc_warmup_mutex;
static std::atomic<bool> g_rpc_running{false}; static std::atomic<bool> g_rpc_running{false};
static bool fRPCInWarmup GUARDED_BY(g_rpc_warmup_mutex) = true; static bool fRPCInWarmup GUARDED_BY(g_rpc_warmup_mutex) = true;
static std::string rpcWarmupStatus GUARDED_BY(g_rpc_warmup_mutex) = "RPC server started"; static std::string rpcWarmupStatus GUARDED_BY(g_rpc_warmup_mutex) = "RPC server started";
/* Timer-creating functions */ /* Timer-creating functions */
static RPCTimerInterface* timerInterface = nullptr; static RPCTimerInterface* timerInterface = nullptr;
/* Map of name to timer. */ /* Map of name to timer. */
static Mutex g_deadline_timers_mutex; static GlobalMutex g_deadline_timers_mutex;
static std::map<std::string, std::unique_ptr<RPCTimerBase> > deadlineTimers GUARDED_BY(g_deadline_timers_mutex); static std::map<std::string, std::unique_ptr<RPCTimerBase> > deadlineTimers GUARDED_BY(g_deadline_timers_mutex);
static bool ExecuteCommand(const CRPCCommand& command, const JSONRPCRequest& request, UniValue& result, bool last_handler); static bool ExecuteCommand(const CRPCCommand& command, const JSONRPCRequest& request, UniValue& result, bool last_handler);

View file

@ -16,7 +16,7 @@
#include <util/translation.h> #include <util/translation.h>
#include <warnings.h> #include <warnings.h>
static Mutex g_timeoffset_mutex; static GlobalMutex g_timeoffset_mutex;
static int64_t nTimeOffset GUARDED_BY(g_timeoffset_mutex) = 0; static int64_t nTimeOffset GUARDED_BY(g_timeoffset_mutex) = 0;
/** /**

View file

@ -96,7 +96,7 @@ const char * const BITCOIN_SETTINGS_FILENAME = "settings.json";
ArgsManager gArgs; ArgsManager gArgs;
/** Mutex to protect dir_locks. */ /** Mutex to protect dir_locks. */
static Mutex cs_dir_locks; static GlobalMutex cs_dir_locks;
/** A map that contains all the currently held directory locks. After /** A map that contains all the currently held directory locks. After
* successful locking, these will be held here until the global destructor * successful locking, these will be held here until the global destructor
* cleans them up and thus automatically unlocks them, or ReleaseDirectoryLocks * cleans them up and thus automatically unlocks them, or ReleaseDirectoryLocks

View file

@ -122,7 +122,7 @@ static constexpr int PRUNE_LOCK_BUFFER{10};
*/ */
RecursiveMutex cs_main; RecursiveMutex cs_main;
Mutex g_best_block_mutex; GlobalMutex g_best_block_mutex;
std::condition_variable g_best_block_cv; std::condition_variable g_best_block_cv;
uint256 g_best_block; uint256 g_best_block;
bool g_parallel_script_checks{false}; bool g_parallel_script_checks{false};

View file

@ -114,7 +114,7 @@ enum class SynchronizationState {
}; };
extern RecursiveMutex cs_main; extern RecursiveMutex cs_main;
extern Mutex g_best_block_mutex; extern GlobalMutex g_best_block_mutex;
extern std::condition_variable g_best_block_cv; extern std::condition_variable g_best_block_cv;
/** Used to notify getblocktemplate RPC of new tips. */ /** Used to notify getblocktemplate RPC of new tips. */
extern uint256 g_best_block; extern uint256 g_best_block;

View file

@ -23,7 +23,7 @@
namespace wallet { namespace wallet {
static constexpr int32_t WALLET_SCHEMA_VERSION = 0; static constexpr int32_t WALLET_SCHEMA_VERSION = 0;
static Mutex g_sqlite_mutex; static GlobalMutex g_sqlite_mutex;
static int g_sqlite_count GUARDED_BY(g_sqlite_mutex) = 0; static int g_sqlite_count GUARDED_BY(g_sqlite_mutex) = 0;
static void ErrorLogCallback(void* arg, int code, const char* msg) static void ErrorLogCallback(void* arg, int code, const char* msg)

View file

@ -173,8 +173,8 @@ void NotifyWalletLoaded(WalletContext& context, const std::shared_ptr<CWallet>&
} }
} }
static Mutex g_loading_wallet_mutex; static GlobalMutex g_loading_wallet_mutex;
static Mutex g_wallet_release_mutex; static GlobalMutex g_wallet_release_mutex;
static std::condition_variable g_wallet_release_cv; static std::condition_variable g_wallet_release_cv;
static std::set<std::string> g_loading_wallet_set GUARDED_BY(g_loading_wallet_mutex); static std::set<std::string> g_loading_wallet_set GUARDED_BY(g_loading_wallet_mutex);
static std::set<std::string> g_unloading_wallet_set GUARDED_BY(g_wallet_release_mutex); static std::set<std::string> g_unloading_wallet_set GUARDED_BY(g_wallet_release_mutex);

View file

@ -12,7 +12,7 @@
#include <vector> #include <vector>
static Mutex g_warnings_mutex; static GlobalMutex g_warnings_mutex;
static bilingual_str g_misc_warnings GUARDED_BY(g_warnings_mutex); static bilingual_str g_misc_warnings GUARDED_BY(g_warnings_mutex);
static bool fLargeWorkInvalidChainFound GUARDED_BY(g_warnings_mutex) = false; static bool fLargeWorkInvalidChainFound GUARDED_BY(g_warnings_mutex) = false;