Modernize best block mutex/cv/hash variable naming

This commit is contained in:
Pieter Wuille 2018-04-03 21:53:07 -07:00
parent 45dd135039
commit 4a6c0e3dcf
4 changed files with 13 additions and 13 deletions

View File

@ -307,7 +307,7 @@ void OnRPCStopped()
{ {
uiInterface.NotifyBlockTip.disconnect(&RPCNotifyBlockChange); uiInterface.NotifyBlockTip.disconnect(&RPCNotifyBlockChange);
RPCNotifyBlockChange(false, nullptr); RPCNotifyBlockChange(false, nullptr);
cvBlockChange.notify_all(); g_best_block_cv.notify_all();
LogPrint(BCLog::RPC, "RPC stopped.\n"); LogPrint(BCLog::RPC, "RPC stopped.\n");
} }

View File

@ -470,10 +470,10 @@ UniValue getblocktemplate(const JSONRPCRequest& request)
{ {
checktxtime = std::chrono::steady_clock::now() + std::chrono::minutes(1); checktxtime = std::chrono::steady_clock::now() + std::chrono::minutes(1);
WaitableLock lock(csBestBlock); WaitableLock lock(g_best_block_mutex);
while (hashBestBlock == hashWatchedChain && IsRPCRunning()) while (g_best_block == hashWatchedChain && IsRPCRunning())
{ {
if (cvBlockChange.wait_until(lock, checktxtime) == std::cv_status::timeout) if (g_best_block_cv.wait_until(lock, checktxtime) == std::cv_status::timeout)
{ {
// Timeout: Check transactions for update // Timeout: Check transactions for update
if (mempool.GetTransactionsUpdated() != nTransactionsUpdatedLastLP) if (mempool.GetTransactionsUpdated() != nTransactionsUpdatedLastLP)

View File

@ -202,9 +202,9 @@ CCriticalSection cs_main;
BlockMap& mapBlockIndex = g_chainstate.mapBlockIndex; BlockMap& mapBlockIndex = g_chainstate.mapBlockIndex;
CChain& chainActive = g_chainstate.chainActive; CChain& chainActive = g_chainstate.chainActive;
CBlockIndex *pindexBestHeader = nullptr; CBlockIndex *pindexBestHeader = nullptr;
CWaitableCriticalSection csBestBlock; CWaitableCriticalSection g_best_block_mutex;
CConditionVariable cvBlockChange; CConditionVariable g_best_block_cv;
uint256 hashBestBlock; uint256 g_best_block;
int nScriptCheckThreads = 0; int nScriptCheckThreads = 0;
std::atomic_bool fImporting(false); std::atomic_bool fImporting(false);
std::atomic_bool fReindex(false); std::atomic_bool fReindex(false);
@ -2197,9 +2197,9 @@ void static UpdateTip(const CBlockIndex *pindexNew, const CChainParams& chainPar
mempool.AddTransactionsUpdated(1); mempool.AddTransactionsUpdated(1);
{ {
WaitableLock lock(csBestBlock); WaitableLock lock(g_best_block_mutex);
hashBestBlock = pindexNew->GetBlockHash(); g_best_block = pindexNew->GetBlockHash();
cvBlockChange.notify_all(); g_best_block_cv.notify_all();
} }
std::vector<std::string> warningMessages; std::vector<std::string> warningMessages;

View File

@ -164,9 +164,9 @@ extern BlockMap& mapBlockIndex;
extern uint64_t nLastBlockTx; extern uint64_t nLastBlockTx;
extern uint64_t nLastBlockWeight; extern uint64_t nLastBlockWeight;
extern const std::string strMessageMagic; extern const std::string strMessageMagic;
extern CWaitableCriticalSection csBestBlock; extern CWaitableCriticalSection g_best_block_mutex;
extern CConditionVariable cvBlockChange; extern CConditionVariable g_best_block_cv;
extern uint256 hashBestBlock; extern uint256 g_best_block;
extern std::atomic_bool fImporting; extern std::atomic_bool fImporting;
extern std::atomic_bool fReindex; extern std::atomic_bool fReindex;
extern int nScriptCheckThreads; extern int nScriptCheckThreads;